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

Duncan Murdoch murdoch at stats.uwo.ca
Tue Apr 24 13:27:47 CEST 2007

On 4/24/2007 4:58 AM, Torsten Hothorn wrote:
>> 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 
> morning.

It's too late for 2.5.0, but not for 2.5.1, or 2.6.0, ...

Just to be clear:  this is a documentation error, right?  The behaviour 
is unchanged back at least as far as 2.2.1.

Duncan Murdoch

More information about the R-devel mailing list