I'm trying to recode this variable, after transforming it in numeric:
e18$AntPT <- recode(e18$AntPT, 1 <- 0, 0 <- c(2:10))
but it returns
Error in 1 <- 0: invalid (do_set) left-hand side to assignment
Also, the final result should include these 3 parts of the code:
e18$AntPT <- as.numeric(e18$Q1501)
e18$AntPT <- recode(e18$AntPT, 1<-1, 0 <- c(2:10))
e18$AntPSDB <- as.numeric(e18$Q1505)
e18$AntPSDB <- recode(e18$AntPSDB, 10<-1, 0 <- c(2:10))
e18$AntPMDB <- as.numeric(e18$Q1502)
e18$AntPMDB <- recode(e18$AntPMDB, 100<-1, 0 <- c(2:10))
The last thing I have to do is:
e18$Ant_Part <- (e18$AntPT + e18$AntPSDB + e18$AntPMDB)
The final result of this sum must give me the numbers 0, 1, 10, 11, 100, 101, 110, 111 - which one of the numbers give me a different interpretation of my initial question.