[R] How many attributes are there of a variable?

Peng Yu pengyu.ut at gmail.com
Sun Sep 6 23:01:06 CEST 2009


Hi,

According to the example below this email, attr(x,"names") is the same
as names(x). I am wondering how many attributes there are of a given
variable. How to find out what they are? Can I always use
some_attribute(x) instead of attr(x, "some_attribute")?

Regards,
Peng

> x=c(1,2,3)
> attr(x,"names")=c("a","b","c")
> x
a b c
1 2 3
>
> y=c(1,2,3)
> names(y)=c("a","b","c")
> y
a b c
1 2 3




More information about the R-help mailing list