我有一个这样的数据集:
temp date
14.09 Aug-13
16.9 Aug-13
16.93 Aug-13
17.7 Sep-13
17.79 Sep-13
17.94 Sep-13
17.04 Oct-13
16.98 Oct-13
16.95 Oct-13
11.9 Nov-13
11.97 Nov-13
12.04 Nov-13
谢谢, 卢卡
答案 0 :(得分:1)
尝试
library(zoo)
df2 <- df1[order(as.yearmon(df1$date, '%b-%y')),]
boxplot(temp~ factor(date, levels=unique(date)), df2)
df1 <- structure(list(temp = c(11.9, 37.7, 17.7, 18.04, 16.93, 25.95,
12.04, 17.94, 16.9, 17.79, 24.93, 26.9, 15.94, 17.04, 11.97,
13.97, 15.09, 17.79, 19.98, 12.9, 14.09, 16.95, 16.98, 14.04),
date = c("Nov-13", "Sep-15", "Sep-13", "Oct-14", "Aug-13",
"Oct-14", "Nov-13", "Sep-13", "Aug-13", "Sep-13", "Aug-15",
"Aug-14", "Sep-15", "Oct-13", "Nov-13", "Nov-14", "Aug-14",
"Sep-15", "Oct-15", "Nov-14", "Aug-13", "Oct-13", "Oct-13",
"Nov-14")), .Names = c("temp", "date"), row.names = c(NA,
-24L), class = "data.frame")