[R] labels attached to variable names

2005-01-06 Thread Denis Chabot
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 CanadaFisheries  Oceans Canada
CP 1000, Mont-Joli, QC  PB 1000, Mont-Joli, QC
G5H 3Z4G5H 3Z4
Canada  Canada

(418) 775-0624   (418) 775-0624
http://www.qc.dfo-mpo.gc.ca/iml
__
R-help@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


Re: [R] labels attached to variable names

2005-01-06 Thread Dimitris Rizopoulos
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 [EMAIL PROTECTED]
To: r-help@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 CanadaFisheries  Oceans Canada
CP 1000, Mont-Joli, QC  PB 1000, Mont-Joli, QC
G5H 3Z4G5H 3Z4
Canada  Canada
(418) 775-0624  (418) 775-0624
http://www.qc.dfo-mpo.gc.ca/iml
__
R-help@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

__
R-help@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


Re: [R] labels attached to variable names

2005-01-06 Thread Anne
I use Frank Harrell's  library Hmisc to do this, it is very convenient!
library(Hmisc)
 label(myVar)-my variable

Anne


- Original Message - 
From: Denis Chabot [EMAIL PROTECTED]
To: r-help@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 CanadaFisheries  Oceans Canada
 CP 1000, Mont-Joli, QC  PB 1000, Mont-Joli, QC
 G5H 3Z4G5H 3Z4
 Canada  Canada

 (418) 775-0624  (418) 775-0624
 http://www.qc.dfo-mpo.gc.ca/iml

 __
 R-help@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

__
R-help@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


Re: [R] labels attached to variable names

2005-01-06 Thread Johan Lindbäck
Denis Chabot wrote:
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

Try
library(Hmisc)
?label
/Johan
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
__
R-help@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


Re: [R] labels attached to variable names

2005-01-06 Thread Gabor Grothendieck
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.

__
R-help@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


Re: [R] labels attached to variable names

2005-01-06 Thread Frank E Harrell Jr
Denis Chabot wrote:
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
The Hmisc package supports this:
label(x) - 'Some Label'
describe(x)# uses variable name and label
plot(x, y, xlab=label(x))
Better: xYplot(x, y)   # label used automatically
And if you do units(x) - 'whatever units of measurement'  then xYplot, 
describe, and other Hmisc functions will include the units (in a 
different font on graphs or when using latex()).

Frank
--
Frank E Harrell Jr   Professor and Chair   School of Medicine
 Department of Biostatistics   Vanderbilt University
__
R-help@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