I'm trying to use the softImpute command (from the softImpute package) for filling in missing values, and I'm trying to turn categorical variables in a large data frame into factor type before using the softImpute.
I've used as.factor command and factor command but they all yield the following
train[a]=factor(train[a])
Error in sort.list(y) : 'x' must be atomic for 'sort.list'
Have you called 'sort' on a list?
a here is a vector like: c(1:92)
I tried as.character too but the softImpute command would not recognize the variables as character and would treat them as numeric, resulting in decimal values for categorical/indicator variables.