From Ulrich.Windl at rz.uni-regensburg.de  Wed Apr 12 14:40:10 2017
From: Ulrich.Windl at rz.uni-regensburg.de (Ulrich Windl)
Date: Wed, 12 Apr 2017 14:40:10 +0200
Subject: [Rd] "table(droplevels(aq)$Month)" in manual page of droplevels
References: <58EE202A020000A10002595B@gwsmtp1.uni-regensburg.de>
Message-ID: <58EE202A020000A10002595B@gwsmtp1.uni-regensburg.de>

The last line of the example in droplevels' manual page seems to be incorrect to me. I think it should read: "table(droplevels(aq$Month))". Amazingly (I don't understand) both variants seem to produce the same result (R 3.3.3):
---
> aq <- transform(airquality, Month = factor(Month, labels = month.abb[5:9]))
> aq <- subset(aq, Month != "Jul")
> table(aq$Month)

May Jun Jul Aug Sep 
 31  30   0  31  30 
> table(droplevels(aq)$Month)

May Jun Aug Sep 
 31  30  31  30 
> table(droplevels(aq$Month))

May Jun Aug Sep 
 31  30  31  30 
>
---
For the sake of learners, try to keep the examples simple and useful, even though you experts want to impress the newbees...

Ulrich



[Rd] "table(droplevels(aq)$Month)" in manual page of droplevels
Ulrich Windl