[R] [R-SIG-Mac] Hist for different levels of a factor

Petr Pikal petr.pikal at precheza.cz
Thu Jan 26 09:27:32 CET 2006


Hi


On 26 Jan 2006 at 8:36, stefano iacus wrote:

From:           	stefano iacus <stefano.iacus at unimi.it>
Date sent:      	Thu, 26 Jan 2006 08:36:49 +0100
To:             	Sylvain Charlat <s.charlat at ucl.ac.uk>
Copies to:      	r-help at stat.math.ethz.ch, r-sig-mac <r-sig-mac at stat.math.ethz.ch>
Subject:        	Re: [R] [R-SIG-Mac] Hist for different levels of a factor

> The list of your interest is R-help not R-sig-mac
> stefano
> 
> Il giorno 26/gen/06, alle ore 01:20, Sylvain Charlat ha scritto:
> 
> > Hi,
> >
> > Is there any simple way to get histogram for different levels of 
> > factor?
> >
> > Say you have the following data set:
> >
> >  Island Sp.diam
> >  Moorea 1.21
> >  Moorea 1.27
> >  Moorea 1.28
> >  Moorea 1.22
> >  Moorea 1.28
> >  Rurutu 1.5
> >  Rurutu 1.67
> >  Rurutu 1.75
> >  Rurutu 1.55
> >  Rurutu 1.7
> >  Rurutu 1.55
> >  Rurutu 1.59
> >  Rurutu 1.66
> >  Rurutu 1.7
> >
> > Is there anything better than:
> >
> >> hist(Sp.diam[factor(Island)=="Moorea"],main="Island=Moorea")

It depends on how you want histograms to be plotted. 

e.g.
library(lattice)
histogram(~Sp.diam|Island)

is one possibility

HTH
Petr


> >
> > followed by
> >
> >> hist(Sp.diam[factor(Island)=="Rurutu"],main="Island=Rurutu")
> >
> > Sorry for this very stupid and basic question...
> >
> > Thanks for any help,
> >
> > Sylvain.
> >
> > ---------------------------------------------------------------
> > Sylvain Charlat s.charlat at ucl.ac.uk / sylvaincharlat at yahoo.fr
> > http://www.ucl.ac.uk/~ucbtghu/Sylvain.htm - Department of Biology,
> > University College London
> >   4 Stephenson Way, London, NW1 2HE, UK
> > - Fieldwork address:
> >   Gump Station, University of California Berkeley
> >   BP 244 Maharepa, 98728 Moorea, French Polynesia
> > - Phone (Moorea): (+689) 56 43 97 or 26 90 18 or 56 52 87
> > - Fax (Moorea): (+689) 56 32 72
> > - Phone / Fax (London): (+44)20 76795072 / +(44) 20 76795052
> > ---------------------------------------------------------------
> >
> >
> >
> >
> > 	
> >
> > 	
> > 		
> > ____________________________________________________________________
> > __ _____ Nouveau : téléphonez moins cher avec Yahoo! Messenger !
> > Découvez  les tarifs exceptionnels pour appeler la France et
> > l'international. Téléchargez sur http://fr.messenger.yahoo.com
> >
> > _______________________________________________
> > R-SIG-Mac mailing list
> > R-SIG-Mac at stat.math.ethz.ch
> > https://stat.ethz.ch/mailman/listinfo/r-sig-mac
> 
> ______________________________________________
> 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

Petr Pikal
petr.pikal at precheza.cz




More information about the R-help mailing list