Sorry I don't have example code for this question.
All I want to know is if it is possible to create multiple side-by-side boxplots in R representing different columns/variables within my data frame. Each boxplot would also only represent a single variable--I would like to set the y-scale to a range of (0,6).
If this isn't possible, how can I use something like the panel option in ggplot2 if I only want to create a boxplot using a single variable? Thanks!
Ideally, I want something like the image below but without factor grouping like in ggplot2. Again, each boxplot would represent completely separate and single columns.
ggplot2
requires that your data to be plotted on the y-axis are all in one column.Here is an example:
The
ylim(0,6)
sets the y-axis to be between 0 and 6If your data are in columns, you can get them into the longform using
melt
fromreshape2
orgather
fromtidyr
. (other methods also available).