Side by side boxplots by a categorical variable comparing data from multiple datasets

Hello,

I am trying to compare the distribution of a continuous variable by a categorical variable (water quality by setting). I want to compare 3 different datasets because they have a different number of observations.

I tried using the code below found at https://stackoverflow.com/questions/19483211/i-want-to-put-3-boxplots-from-3-different-datasets-into-one-graph-in-r but it did not work and I think it's because I want to look at a continuous variable by another variable. The point of wanting to visualize it this way is to see how the datasets compare in their distribution at each category.

boxplot(aerobic1, at = 1, xlim = c(0.5, 3.5), 
  ylim = range(c(aerobic1, aerobic2, aerobic3)))
boxplot(aerobic2, at = 2, add = TRUE)
boxplot(aerobic3, at = 3, add = TRUE)

What is the best way to do this? or am I missing something from the code above?

Are you open to using ggplot2?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.