[R] Error in tapply when reordering levels of a factor

Thomas Levine thomas.levine at gmail.com
Sun Feb 28 04:01:19 CET 2010


I have this

> grades$grade
...
[4009] A  B  A- A- A- B+ A  A- B+ B  A  B  B  B  A  A- A  A- A- B+ A- A  A  B+
[4033] A- A- A- A  A- B  A  A  A- A
Levels: A A- A+ B B- B+ C  C+

I want to change the order of the levels

> reorder(grades$grade,c('A+','A','A-','B+','B','B-','C+','C'))
Error in tapply(X, x, FUN, ...) : arguments must have same length

What am I doing wrong? Thanks

Tom



More information about the R-help mailing list