Your problem is that columns A & B contain something that can't be
ordered. (Likely "factor" (=categorical) data like Male / Female
rather than numeric like 10 and 5)
Use str(data_2) to see what classes your data are -- they sometimes
get converted in unexpected ways if you aren't careful in setti
Hi,
I am stuck with creating a conditional categorical variable in R
If my dataframe data_2 has 3 variables A,B,CI want to create variable D
which would be something like :
data_2$D <- ifelse(data_2$A < data_2$B & promotion_ind =="N",1,0),
this throws up an error "In Ops.factor(data_2$A,dat
2 matches
Mail list logo