I'm currently building a business calculator for my company, but it seems not to work...
Here is my code :
FGEN<-function(var1){
for (i in 1:length(FRANCH)){
FFGEN[i]<-if(var1[i]%in%c("CHOS020","CHOS025","CRES010")==FALSE){
if(FRANCH[i]==0){
FFGEN[i]<-as.numeric(filter(KTE_GI,KTE_GI$B_COEFF=="C_FRANCHISE",KTE_GI$B_PARAMC2=="0",KTE_GI$B_PARAMC3=="****")[,12])
}else if(FRANCH[i]==18){
FFGEN[i]<-as.numeric(filter(KTE_GI,KTE_GI$B_COEFF=="C_FRANCHISE",KTE_GI$B_PARAMC2=="18",KTE_GI$B_PARAMC3=="****")[,12])
}else if(FRANCH[i]==27){
FFGEN[i]<-as.numeric(filter(KTE_GI,KTE_GI$B_COEFF=="C_FRANCHISE",KTE_GI$B_PARAMC2=="27",KTE_GI$B_PARAMC3=="****")[,12])
}else if(FRANCH[i]==36){
FFGEN[i]<-as.numeric(filter(KTE_GI,KTE_GI$B_COEFF=="C_FRANCHISE",KTE_GI$B_PARAMC2=="36",KTE_GI$B_PARAMC3=="****")[,12])
}else if(FRANCH[i]==55){
FFGEN[i]<-as.numeric(filter(KTE_GI,KTE_GI$B_COEFF=="C_FRANCHISE",KTE_GI$B_PARAMC2=="55",KTE_GI$B_PARAMC3=="****")[,12])
}else if(FRANCH[i]==72){
FFGEN[i]<-as.numeric(filter(KTE_GI,KTE_GI$B_COEFF=="C_FRANCHISE",KTE_GI$B_PARAMC2=="72",KTE_GI$B_PARAMC3=="****")[,12])
}else if(FRANCH[i]==91){
FFGEN[i]<-as.numeric(filter(KTE_GI,KTE_GI$B_COEFF=="C_FRANCHISE",KTE_GI$B_PARAMC2=="91",KTE_GI$B_PARAMC3=="****")[,12])
}else{
FFGEN[i]<-1
}
}else if(var1[i]%in%c("CHOS020","CHOS025","CRES010")==TRUE){
if(FRANCH[i]==0){
FFGEN[i]<-as.numeric(filter(KTE_GI,KTE_GI$B_COEFF=="C_FRANCHISE",KTE_GI$B_PARAMC2=="0",KTE_GI$B_PARAMC3==var1[i])[,12])
}else if(FRANCH[i]==18){
FFGEN[i]<-as.numeric(filter(KTE_GI,KTE_GI$B_COEFF=="C_FRANCHISE",KTE_GI$B_PARAMC2=="18",KTE_GI$B_PARAMC3==var1[i])[,12])
}else if(FRANCH[i]==27){
FFGEN[i]<-as.numeric(filter(KTE_GI,KTE_GI$B_COEFF=="C_FRANCHISE",KTE_GI$B_PARAMC2=="27",KTE_GI$B_PARAMC3==var1[i])[,12])
}else if(FRANCH[i]==36){
FFGEN[i]<-as.numeric(filter(KTE_GI,KTE_GI$B_COEFF=="C_FRANCHISE",KTE_GI$B_PARAMC2=="36",KTE_GI$B_PARAMC3==var1[i])[,12])
}else if(FRANCH[i]==55){
FFGEN[i]<-as.numeric(filter(KTE_GI,KTE_GI$B_COEFF=="C_FRANCHISE",KTE_GI$B_PARAMC2=="55",KTE_GI$B_PARAMC3==var1[i])[,12])
}else if(FRANCH[i]==72){
FFGEN[i]<-as.numeric(filter(KTE_GI,KTE_GI$B_COEFF=="C_FRANCHISE",KTE_GI$B_PARAMC2=="72",KTE_GI$B_PARAMC3==var1[i])[,12])
}else if(FRANCH[i]==91){
FFGEN[i]<-as.numeric(filter(KTE_GI,KTE_GI$B_COEFF=="C_FRANCHISE",KTE_GI$B_PARAMC2=="91",KTE_GI$B_PARAMC3==var1[i])[,12])
}else{
FFGEN[i]<-1
}
}
}
return(FFGEN)}
When I execute it, a message shows up :
4.stop("'arg' must be NULL or a character vector")
3.match.arg(method)
2.filter(KTE_GI, KTE_GI$B_COEFF == "C_FRANCHISE", KTE_GI$B_PARAMC2 == "18", KTE_GI$B_PARAMC3 == "****")
- FGEN(CODE_ACT)
Is there anyone who knows what's the problem pls?
(Ps.: I'm french, sorry if there's some mistakes ^^')
Summary
This text will be hidden