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

2012-03-01 Thread ilai
Jon, You could create new variables with the combined levels just for the purpose of plotting. Assume I have data.frame bpt str(bpt) 'data.frame': 12 obs. of 2 variables: $ V1: Factor w/ 3 levels "low","med","high": 1 1 1 1 2 2 2 2 3 3 ... $ V2: Factor w/ 6 levels "1","2","3","4",..: 1 1 2 2 3

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

2012-03-01 Thread jon waterhouse
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 s