[R] Combining boxplot

Philippe Massicotte philippe.massicotte at uqtr.ca
Mon Feb 25 17:04:13 CET 2013

Hi everyone.
I have two data frames that contain the same variables but with different
number of observation.
I would like to know it was possible to combine the data so I can have
"paired" boxplot on the same figure.
For example,
df1 = data.frame(x = rnorm(100))
df1$type = ifelse(df1$x <= 0 , "type1", "type2")
df2 = data.frame(x = rnorm(50,0,2))
df2$type = ifelse(df2$x <= 0 , "type1", "type2")
## How to combine boxplot
df1 would be observed data whereas df2 would be simulated data.
I would like to have the two categories (type1 and type2) on x axis and a
colour to differentiate simulated vs observed datra.

More information about the R-help mailing list