I want to reclassify the contents within one variable (BS3_1_1) in the data (knhanes_age_42_N), but it doesn't work well.
Previously, I removed the missing values as na.omit.
knhanes_age_42_N<-transform(knhanes_age_42_N, smoke=ifelse(BS3_1_1=="1" & BS3_1_1=="2", "smoke3", ifelse(BS3_1_1=="3", "smoke2", ifelse(BS3_1_1=="8", "smoke1"))))
I would like to classify "1" and "2" in the variable as "smoke1", classify "3" as "smoke2", and finally reclassify "8" as "smoke3".
But it keeps coming out like the bottom.
Error in ifelse(BS3_1_1 == "8", "4") :
argument "no" is missing, with no default
I need help because it's my first rstudio.