[R] is it possible to combine multiple barplots?

Philipp Schmidt phi.schmidt at gmail.com
Tue Jun 9 16:23:32 CEST 2009


i am working with two sets of likert scale type (4 distinct values) data:

dataA <- rep(1:4, c(3,2,2,4))
dataB <- rep(1:4, c(5,4,3,2))

i can now (bar)plot both of these separately and compare the distributions.

plot(table(dataA), type='h')
plot(table(dataB), type='h')

is there a way to plot both of them in one plot, so that the bars for
value "1" (dataA: 3, dataB: 5) would appear side by side, followed by
the bars for value 2 etc.?

thanks!

best - P




More information about the R-help mailing list