dropping factor levels in subset
"Adaikalavan Ramasamy" <gisar at nus.edu.sg> writes:
Another option is pruneLevels() in library nlme. x <- factor( c( 0,1,2,1,2 ) )
x
[1] 0 1 2 1 2 Levels: 0 1 2
pruneLevels( x[-1] )
[1] 1 2 1 2 Levels: 1 2
That function has been removed from the latest release of the nlme package because it not needed. All uses of pruneLevels in nlme were replaced by code of the form myfactor[] = myfactor[, drop = TRUE]