[R] "labels" attached to variable names

Gabor Grothendieck ggrothendieck at myway.com
Thu Jan 6 16:54:13 CET 2005


Denis Chabot <chabotd <at> globetrotter.net> writes:

: 
: Hi,
: 
: Can we attach a more descriptive "label" (I may use the wrong  
: terminology, which would explain why I found nothing on the FAQ) to  
: variable names, and later have an easy way to switch to these labels in  
: plots? I fear this is not possible and one must enter this by hand as  
: ylab and xlab when making plots.

See ?comment . e.g.

x <- 1:10
comment(x) <- "My X"
y <- x*x
comment(y) <- "My Y"

plot(x, y, xlab = comment(x), ylab = comment(y))


Another possibility is 'label' in package Hmisc.




More information about the R-help mailing list