[R] "labels" attached to variable names

Dimitris Rizopoulos dimitris.rizopoulos at med.kuleuven.ac.be
Thu Jan 6 16:10:30 CET 2005


Hi Denis,

maybe something like this could be helpful:

x <- rnorm(20, 75); attr(x, "label") <- "Weight of Males"
y <- rnorm(20, 60); attr(y, "label") <- "Weight of Females"
plot. <- function(x, y, ...) plot.default(x, y, xlab=attr(x, "label"), 
ylab=attr(y, "label"), ...)
############
plot(x, y)
plot.(x, y)



Best,
Dimitris

----
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/16/336899
Fax: +32/16/337015
Web: http://www.med.kuleuven.ac.be/biostat
     http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm



----- Original Message ----- 
From: "Denis Chabot" <chabotd at globetrotter.net>
To: <r-help at stat.math.ethz.ch>
Sent: Thursday, January 06, 2005 3:40 PM
Subject: [R] "labels" attached to variable names


> 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.
>
> Thanks in advance,
>
> Denis Chabot
> ------------------------------------------------------------------------
> ---------------------------
> Denis Chabot, Ph.D.
> Chercheur en bioénergétique           Bioenergetics researcher
> Institut Maurice-Lamontagne             Institut Maurice-Lamontagne
> Pêches et Océans Canada                Fisheries & Oceans Canada
> CP 1000, Mont-Joli, QC                      PB 1000, Mont-Joli, QC
> G5H 3Z4                                                G5H 3Z4
> Canada                                                  Canada
>
> (418) 775-0624          (418) 775-0624
> http://www.qc.dfo-mpo.gc.ca/iml
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
>




More information about the R-help mailing list