[R] Subsetting does not remove unwanted data in table

Ben Bolker bbolker at gmail.com
Wed Sep 7 21:52:43 CEST 2011


Scott Bearer <sbearer <at> TNC.ORG> writes:

> 
> Dear all,
> 
> This relatively routine analysis has left me frustrated and in a rut.  I
> have a dataset (data1), which I subset in order to remove rows where
> HabitatDensity="Med".  This dataset looks correct when I call it up,
> however, when I create a table out of the new subset (data2), my table
> continues to show the "Med" information as 0.  

  assuming you're using a recent version of R (2.13.+),

?droplevels

  otherwise

library(gdata)
?drop.levels (you probably want reorder=FALSE)



More information about the R-help mailing list