I'm trying to plot 4 groups of data as boxplots on the same set of axis.
I've been able to use the print() function to plot them on separate plots, but can't figure out how to plot them all together, preferably using the base package or lattice
below is some code I am trying, but it keeps coming up with error:
Error in x[floor(d)] + x[ceiling(d)] :
non-numeric argument to binary operator
Heres the code I'm currently trying:
Summer <- SeasonalMax$Summer
Autumn <- SeasonalMax$Autumn
Winter <- SeasonalMax$Winter
Spring <- SeasonalMax$Spring
boxplot(Summer, Autumn, Winter, Spring,
main = "Multiple boxplots for comparision",
at = c(1,2,3,4),
names = c("Summer", "Autumn", "Winter", "Spring"),
las = 2,
col = c("red","orange", "blue", "pink"))
First melt the data into long format
Then melt the data into long format with either : reshape2 package
or tidyr package
Then when you plot the boxplot , use the formula argument as follows [I will continue with tidyr because I named the columns]
And with all your additions