How to make a boxplot with exclusion of certain groups

How to make a boxplot with exclusion of certain groups

This seems like a simple thing, but I have been stuck for some time. My
data has 2 columns. Column 1 is the value, and column 2 is the Site where
data was collected. Column 2 contains 7 different Sites (i.e. groups). I
am only interested in showing 3 groups on a single boxplot.

I have tried various methods of subsetting the data, in order to only have
the 3 groups in my subset. However even after doing this, all 7 groups
carry forward, so that when I make a boxplot of my subsetted data, all 7
groups still appear in the x-axis labels; all 7 groups also appear in the
boxplot summary (i.e. the values returned with boxplot (â¦plot=FALSE) ) .
Even if I delete the unwanted groups from the âlevelsâ of Column 2, they
still appear on the plot, and in the boxplot summary statistics.

There are various tricks I can do with the boxplot summary statistics to
correct for this, but they get complicated when I want to change the
algorithm for calculating outliers and their corresponding groups. Rather
than do all these tricks, it seems much simpler to fully exclude the
unwanted groups from the beginning. But this doesnât appear to work

Re: How to make a boxplot with exclusion of certain groups

> This seems like a simple thing, but I have been stuck for some time. My
> data has 2 columns. Column 1 is the value, and column 2 is the Site where
> data was collected. Column 2 contains 7 different Sites (i.e. groups). I
> am only interested in showing 3 groups on a single boxplot.
>
> I have tried various methods of subsetting the data, in order to only have
> the 3 groups in my subset. However even after doing this, all 7 groups
> carry forward, so that when I make a boxplot of my subsetted data, all 7
> groups still appear in the x-axis labels; all 7 groups also appear in the
> boxplot summary (i.e. the values returned with boxplot (â€¦plot=FALSE) ) .
> Even if I delete the unwanted groups from the â€˜levelsâ€™ of Column 2, they
> still appear on the plot, and in the boxplot summary statistics.
>
> There are various tricks I can do with the boxplot summary statistics to
> correct for this, but they get complicated when I want to change the
> algorithm for calculating outliers and their corresponding groups. Rather
> than do all these tricks, it seems much simpler to fully exclude the
> unwanted groups from the beginning. But this doesnâ€™t appear to work
>
> Any ideas?