Skip to content
Back to formatted view

Raw Message

Message-ID: <6r8yrjsdog.fsf@bates4.stat.wisc.edu>
Date: 2003-06-30T17:00:52Z
From: Douglas Bates
Subject: dropping factor levels in subset
In-Reply-To: <CDA8D2689259E444942B3CDED8DD912932D46B@MBXSRV03.stf.nus.edu.sg>

"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]