hello,
I would like to create the following barplot:
I have 4 different data sets (same length + stddev for each data point)
data1
sd1
data2
sd2
data3
sd3
data4
sd4
now, I'd like to plot in the following way:
data1[1],data2[1],data3[1],data4[1] with it's sd-values side-by-side at
one x-axis
tab - do.call(rbind, list(data1, data2, data3, data4))
etype - rep(c(sd1, sd2, sd3, sd4), length(data1))
b - barplot(tab, beside=T)
arrows(unlist(b), unlist(tab) - etype, unlist(b), unlist(tab) + etype, code=3)
---
Jacques VESLOT
Thank you very much for your help.
I just don't understand the following line (which also gives me a
dimension error later in the arrows command)
etype - rep(c(sd1, sd2, sd3, sd4), length(data1))
Antje
(I don't see my emails to the mailinglist anymore... just the answers
from other people...
thought sd1, sd2... were scalars but if not just do:
etype - c(sd1, sd2, sd3, sd4)
---
Jacques VESLOT
CNRS UMR 8090
I.B.L (2ème étage)
1 rue du Professeur Calmette
B.P. 245
59019 Lille Cedex
Tel : 33 (0)3.20.87.10.44
Fax : 33
] Namens Antje
Verzonden: vrijdag 24 november 2006 13:42
Aan: r-help@stat.math.ethz.ch
Onderwerp: Re: [R] barplot help needed
Thank you very much for your help.
I just don't understand the following line (which also gives me a
dimension error later in the arrows command)
etype - rep(c(sd1, sd2, sd3
Still, there is one problem. The SD-Values don't fit to the bar they
belong to. I made the following experiment:
data1 - c(2,4,6,2,5)
data2 - data1
sd1 - c(0.5,1,1.5,1,2)
sd2 - sd1
tab - do.call(rbind, list(data1, data2))
etype - c(sd1,sd2)
b - barplot(tab, beside=T)
PROTECTED] [mailto:[EMAIL PROTECTED] Namens Antje
Verzonden: vrijdag 24 november 2006 16:17
Aan: r-help@stat.math.ethz.ch
Onderwerp: Re: [R] barplot help needed
Still, there is one problem. The SD-Values don't fit to the bar they
belong to. I made the following experiment:
data1 - c(2,4,6,2,5
tab - do.call(rbind, list(data1, data2, data3, data4))
etype - do.call(rbind, list(sd1, sd2, sd3, sd4))
b - barplot(tab, beside=T, ylim=c(0,max(tab+etype)))
arrows(as.vector(b), as.vector(tab) - as.vector(etype), as.vector(b),
as.vector(tab) +
as.vector(etype), code=3)
unlist() is not correct