22 Dec 2003 01:38
Re: [R] Factor names & levels
Damon Wischik <djw1005 <at> cam.ac.uk>
2003-12-22 00:38:14 GMT
2003-12-22 00:38:14 GMT
> 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.
I still want to know how I should understand the following:
> x <- factor(c("one","three"))
> names(x) <- c("fred","jim")
> names(x)
[1] "fred" "jim"
class(x)
[1] "factor"
Given that names seems to work on factors, I can see two possibilities:
1. It is a bug that it acts as it does;
2. the default method does what it says in the help page, but also does
more than just this.
I don't know enough to look at the source code to find out what is going
on.
Damon.
______________________________________________
R-help <at> stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
(Continue reading)
RSS Feed