On 10/10/2009 06:34 PM, tulesparo wrote:
Hello,

I am a beginner with R and I would need some help with doing the barplot I
want.

In fact I want to draw a barplot from my table, but the issue is that only
the modalities with nonzero values are plotted ; the fact is that I would
plot all the modalities, including those which have no value.

If I'm not clear, here is an example : let X, Y and Z be three modalities
which have respectively 2, 0 and 3 values ; my current barplot only draws X
and Z, and I also would draw Y.


Hi tulesparo,
If you mean something like this:

xyz<-matrix(c(2,6,NA,NA,NA,NA,4,7,1),ncol=3)
barplot(xyz,beside=TRUE)

you can get zero height bars for y like this:

xyz[is.na(xyz)]<-0
barplot(xyz,beside=TRUE)

PS : Sorry if I've made mistakes, I'm French...
Ne vous inquiétez pas, mon ami, ce n'est pas votre faute.

Jim

______________________________________________
R-help@r-project.org 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.

Reply via email to