I have a survey object with one variable that has six factor levels. I'm trying to group the first two, the second two, and the last two levels so that I then have only three levels which I can give descriptive names to.
I have been trying to adapt:
X=update(X, Passed=factor(Pass), labels=c("No Pass", "No Pass", "Pass", "Pass", NA, NA))
But have been getting the error:
Error in `[<-.data.frame`(`*tmp*`, , newnames[j], value = c("No Pass", : replacement has 6 rows, data has 5444
Have I made a silly mistake or have I got the wrong end of the stick?
For Example:
No Pass values are 1 and 2
Pass values are 3 and 4
Then 7 and 8 are NA
Obs Passed
1 1
2 2
3 1
4 7
5 3
6 3
7 3
8 2
9 1
10 4