[R] Adding labels to variables

Gabor Grothendieck ggrothendieck at myway.com
Wed Aug 25 08:20:27 CEST 2004


Neil Leonard <nleonard <at> tartarus.uwa.edu.au> writes:

: Is it possible to add labels to variables in R (so as to have a better 
: description of what the variables represent)?

One can add arbitrarily named attributes to objects.  For example,
we can add an attribute which we shall call memo to object z:

R> z <- 3
R> attr(z,"memo") <- "very important number"

R> # sometime later
R> z
[1] 3
attr(,"memo")
[1] "very important number"




More information about the R-help mailing list