[R] label histogram question

Petr Pikal petr.pikal at precheza.cz
Fri Mar 2 09:29:41 CET 2007


Hi

in your case I would use for loop (although common practice i to 
distract from their use :-), maybe together with main and axes 
options.

Or probably lattice histogram could be used too.

HTH
Petr





On 1 Mar 2007 at 22:17, Aimin Yan wrote:

Date sent:      	Thu, 01 Mar 2007 22:17:26 -0600
To:             	r-help at stat.math.ethz.ch
From:           	Aimin Yan <aiminy at iastate.edu>
Subject:        	[R] label histogram question

> Dear R list:
> 
> I have a data like this
>  > head(data.19.pr.2)
>      pr    Ave    Sd M#    Re  Aa
> 1 1A24  57.66 33.50 20 ALA_1 ALA
> 2 1A24  72.16 19.75 20 GLN_2 GLN
> 3 1A24 103.52  8.64 20 TYR_3 TYR
> 4 1A24  38.67 15.51 20 GLU_4 GLU
> 5 1A24  54.56 16.43 20 ASP_5 ASP
> 6 1A24 999.00  0.00 20 GLY_6 GLY
>  > levels(data.19.pr.2$Aa)
>   [1] "ALA" "ARG" "ASN" "ASP" "CYS" "GLN" "GLU" "GLY" "HIS" "ILE"
>   "LEU" 
> "LYS" "MET" "PHE" "PRO" "SER" "THR" "TRP" "TYR" "VAL"
> 
> I want to do histogram for Sd grouped by 20 levels of Aa, and put 20
> histograms in one page. I use this code to do job
> 
> par(mfrow=c(4,5))
> tapply(data.19.pr.2$Sd,data.19.pr.2$Aa,hist)
> 
> I get all 20 histogram in one page,but main label of each histogram is
> labeled by "Histogram of X[[1]]" and xlab is labeled by "X[[1]]". I
> want to change these labels using 20 levels of Aa . it look like this:
> "Histogram of ALA"
> 
> Does anyone know how to code these?
> 
> Aimin
> 
> ______________________________________________
> 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 and provide commented,
> minimal, self-contained, reproducible code.

Petr Pikal
petr.pikal at precheza.cz



More information about the R-help mailing list