@bhaskarjit wrote:
my dataset has 60 variables, each variables has ordinal value with 5 levels (Agree, Disagree, Neutral, Strongly Agree, Strongly Disagree), but it is showing 6 levels with addition of level " ".
str(shopping$Felt_Unhappy) Factor w/ 6 levels "","Agree","Disagree",..: 3 4 2 3 4 3 4 2 3 2 ...
I want to remove that unnecessary level from all the columns. I am using the code
for (i in colnames(shopping[,11:60])){ shopping$i <- factor(shopping$i) }
after executing the above code I am getting the following error
Error in `$<-.data.frame`(`*tmp*`, "i", value = integer(0)) : replacement has 0 rows, data has 162
How to do this? Please help
Posts: 2
Participants: 2