I have been using ggplot2 with geom_boxplot
to plot multiple boxplots in one graph. The data looks something like thst below.
Month Rainfall
1 45
1 12
1 14
2 65
2 45
2 78
3 10
3 35
3 92
. .
. .
. .
So by using boxplot I want to see the boxplot for the values of Rainfall for each group (1,2,3...). The result I am getting is weird and order seems messed up. Any help?
ggplot(data=edit3)+geom_boxplot(aes(x=Month, y=Rainfall))
Note: edit3 is the dataframe with the values of Rainfall and Month.
dput(head(edit3[,c("Month","Rainfall")],9))
structure(list(Month = c("1", "1", "1", "1", "1", "1", "1", "1",
"2"), Rainfall = c(NA, 135.6, 34.2, 39.4, 134.6, 234.6, 69.6,
92.8, NA)), row.names = c(NA, -9L), class = c("tbl_df", "tbl",
"data.frame"))
edit3$Month <- as.integer(edit3$Month)
and the result is only one boxplot of the total values of Rainfall. Any suggestion? – akisas.integer
won't necessarily convert it the way you want. Se my second link. – jorangroup = Month
. – joran