[Rd] nlevels(<no factor>) is 0 and not NA

Torsten Hothorn hothorn at hothorn.de
Tue Apr 24 10:58:26 CEST 2007

> nlevels(c("a", "b"))
[1] 0

but the documentation in R 2.5.0 (and earlier) says

 	If the argument is not a 'factor', 'NA' is returned.

I hope it isn't too late, I only came across this in a lecture this 



More information about the R-devel mailing list