[R] Passing colnames to graphics title

Dimitris Rizopoulos dimitris.rizopoulos at med.kuleuven.ac.be
Wed Feb 16 15:46:18 CET 2005


a simple thing to do is:

mat <- matrix(...) # your matrix
nams <- dimnames(mat)[[2]]
for(j in 1:ncol(mat)) hist(mat[,j], main=nams[j])
# or hist(mat[,j], xlab=paste("...", nams[j], "..."))

I hope it helps.

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: "Laura Quinn" <laura at env.leeds.ac.uk>
To: <r-help at stat.math.ethz.ch>
Sent: Wednesday, February 16, 2005 2:56 PM
Subject: [R] Passing colnames to graphics title


> Hi,
>
> Just a quick query - if I'm creating a function to produce a number 
> of
> histograms per page of output (one per column from a matrix), how 
> can I
> pass the column name of the matrix into the title (or indeed to form 
> part
> of the x-axis label)?
>
> TIA,
> Laura
>
> Laura Quinn
> Institute of Atmospheric Science
> School of Earth and Environment
> University of Leeds
> Leeds
> LS2 9JT
>
> tel: +44 113 343 1596
> fax: +44 113 343 6716
> mail: laura at env.leeds.ac.uk
>
> ______________________________________________
> 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