the condition has length > 1 and only the first element will be used
Warning in …. :
the condition has length > 1 and only the first element will be used
comparing a vector with a scalar
=> R automatically takes the first element of var
var = c("A","B","C","D") if (var %in% c("B", "C")) {...} if (var == "D")) {...}