0
votes

What is wrong with this code snippet? Why I get this error:

Error in sort.list(y) : 'x' must be atomic for 'sort.list Have you called 'sort' on a list?"

survey <- surveyFromCSV
survey <- subset(survey, survey$X6 != "german")
survey <- factor(survey)
1

1 Answers

1
votes

survey is a data.frame so what do you expect factor(survey) to do?

If you want to convert everything to factors then you may do:

survey <- data.frame(lapply(survey,as.factor))