[R] Factor names & levels
Gabor Grothendieck
ggrothendieck at myway.com
Sun Dec 21 19:16:58 CET 2003
I agree it may not be 100% clear but ?names does say
"The default methods get and set the '"names"' attribute
of a vector or list." and if you issue the command:
methods("names")
you find that the only non-default method is names.dist.
Date: Sun, 21 Dec 2003 17:54:25 +0000 (GMT)
From: Damon Wischik <djw1005 at cam.ac.uk>
To: Gabor Grothendieck <ggrothendieck at myway.com>
Cc: <R-help at stat.math.ethz.ch>
Subject: Re: [R] Factor names & levels
> names() is only defined for vectors and lists and factors are
> neither. See ?vector and ?names for more info.
?vector tells me that factors are not vectors, but ?names does not tell me
that names() is only defined for vectors and lists. If it were, how
should I understand the following?
> x <- factor(c("one","three"))
> names(x) <- c("fred","jim")
> names(x)
[1] "fred" "jim"
> class(x)
[1] "factor"
More information about the R-help
mailing list