I would like to divide a dataframe (cl) into several blocks and work with them within this dataframe. I proceed to the block ADL:
adlvars<- c("ADL_H1", "ADL_H2", "ADL_H3", "ADL_H4", "ADL_H5", "ADL_H6")
Further, I should convert the factors into character as it prescribed in the FAQ.R
cl[,adlvars] <- as.numeric(levels(cl[,adlvars]))[as.integer(cl[,adlvars])]
There is a warning:
Error: (list) object cannot be coerced to type 'integer'
The second option in the FAQ.R is
cl[,adlvars] <- as.numeric(as.character(cl[adlvars]))
There is a warning message:
NAs introduced by coercion
Table function returns all the values were changed to NAs.
Please help to find a solution. Many thanks!