On 12 Mar 2012, at 12:47 , S Ellison wrote:

> Yes, to the extent that the default barplot plots the height of the bar so 
> far as the sum of teh values so far, starting at teh first. For your first 
> vector, no problem; for your second, the highest value is undefiuned, for the 
> third, the sum is undefined after the second value (an NA) and so on.
> 
> Try adding 'beside=TRUE to the barplots, as in
> barplot(d3, beside=TRUE)
> and you will see all the known values plotted as you;d expect.

That makes sense, but since I do want a stacked bar plot, I'll need to change 
the NAs to 0 (which of course I've already done).

This should be made clear in the documentation, no? It's possible that barplot 
could do something like a na.rm=T internally and avoid this problem, but it 
doesn't, so NA is deadly in stacked plots. To be honest, if I hadn't scaled all 
my bars to 1 to show percentages, I wouldn't have noticed how some were leaving 
out a small category or two.

Thanks for the help.

John Muccigrosso

______________________________________________
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