[R] Remove levels
Uwe Ligges
ligges at statistik.uni-dortmund.de
Thu Nov 10 15:10:33 CET 2005
Marc Bernard wrote:
> Daer All,
>
> I have a factor variable, X with 5 levels. When I type tables(X) it gives me:
>
> table(X)
> 1 2 3 4 5
> 10 5 0 0 0
>
> How to drop the levels with zeros such that when I will type:
> table(X) it will give me:
>
> table(X)
> 1 2
> 10 5
table(X[,drop=TRUE])
Uwe Ligges
>
> Thank a lot,
>
> Bernard
>
>
>
>
> ---------------------------------
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
More information about the R-help
mailing list