[R] barplot as Trellis graphic (corrected)
Agustin Lobo
Agustin.Lobo at ija.csic.es
Wed Mar 26 22:51:29 CET 2008
In the code of my previous message
the barplot should be:
barplot(apply(sel[,-1],2,mean))
instead of
barplot(sel)
Sorry for the confusion.
Agus
-------- Mensaje original --------
Asunto: barplot as Trellis graphic
Fecha: Wed, 26 Mar 2008 22:24:04 +0100
De: Agustin Lobo <Agustin.Lobo at ija.csic.es>
Responder a: Agustin.Lobo at ija.csic.es
Para: r-help at r-project.org
Dear list,
Is there any way of making barplots as a Trellis graphic?
Currently I do something like:
class <- unique(mydata[,1])
par(mfrow=c(3,3))
for(i in class){
sel <- mydata[mydata[,1]==i,]
barplot(sel)
title(i)
}
where class would take values between 1 and 9
and the first column of mydata would be the class.
But I'm looking for a nicer code and a nicer graphic
using the approach of the lattice package.
Thanks!
--
Dr. Agustin Lobo
Institut de Ciencies de la Terra "Jaume Almera" (CSIC)
LLuis Sole Sabaris s/n
08028 Barcelona
Spain
Tel. 34 934095410
Fax. 34 934110012
email: Agustin.Lobo at ija.csic.es
http://www.ija.csic.es/gt/obster
--
Dr. Agustin Lobo
Institut de Ciencies de la Terra "Jaume Almera" (CSIC)
LLuis Sole Sabaris s/n
08028 Barcelona
Spain
Tel. 34 934095410
Fax. 34 934110012
email: Agustin.Lobo at ija.csic.es
http://www.ija.csic.es/gt/obster
--
Dr. Agustin Lobo
Institut de Ciencies de la Terra "Jaume Almera" (CSIC)
LLuis Sole Sabaris s/n
08028 Barcelona
Spain
Tel. 34 934095410
Fax. 34 934110012
email: Agustin.Lobo at ija.csic.es
http://www.ija.csic.es/gt/obster
More information about the R-help
mailing list