[R] barplots of several variables with different number of categories

jon waterhouse jonwaterhouse at gov.nl.ca
Thu Mar 1 15:19:01 CET 2012


If I have two factors, v1 and v2 and I want to have a stacked bar graph of
the two variables side by side I could do

barplot(cbind(table(v1),table(v2)))

if v1 and v2 have the same number of categories.

If they don't have the same number of categories this won't work.

I'm sure there's a simple solution?

Thanks,

Jon

--
View this message in context: http://r.789695.n4.nabble.com/barplots-of-several-variables-with-different-number-of-categories-tp4435092p4435092.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list