Good evening,
I have the following dataframe :
df <- data.frame(I(list(c("nugget de blé","boeuf"),"nugget de blé")))
list_dishes <- c("nugget de blé")
I want to identify the df's dishes in list_dishes: counting 1 when a dishes is identified.
I wrote the following algorithm but it doesn't word. Basically the algorithm identify only when "nugget the blé" is alone.
classification <- function(X,list){
compteur = 0
if(length(which(X%in%list)>=1){compteur = compteur + 1}
return(compteur)
}
results <- data.frame(apply(df, c(1,2), function(x) calcul(x,list_dishes)))
Can you help me please.
Thanks