R boxplot with which function
I have data from 2 field sampling campaigns. I have organised the data severeal columns and rows:
- Data = sample points
- Columns = elements (1,...,n) , season, Sampletype and some others.
Add. info on Columns:
- season = 1,2 (discriminating between seasons)
- sampletype = 1,2,3 (discriminating between sampletypes)
These 2 columns are in factor format.
What I want: A boxplot which shows the boxplot for an element i for the season 1 and for season 2 (In one graph). However, not over all sampletypes but only 1, e.g:
boxplot(element i ~ Season)
This would give 开发者_如何转开发me the boxplot of the data of element i over all sample types but differentiated between the seasons. But I just want it for 1 sampletype.
How do I do this?
Use the subset
parameter:
boxplot(element~Season,data=Data,subset=sampletype==1)
精彩评论