我想使用以下代码创建自动绘图功能:
plotTimeSeries <- list(temp1,temp2)
lapply(1:length(plotTimeSeries) , function(i)
i$dt=strptime(i$dt, "%Y-%m-%d %H:%M:%S")
ggplot(i, aes(dt, ambtemp)) + geom_line() +
scale_x_datetime(breaks = date_breaks("2 hour"),labels=date_format("%H:%M")) + xlab("Time 00.00 ~ 24:00 (2007-09-29)") + ylab("Ambient Tempreture")+
opts(title = ("Node i")))
但是我遇到了以下错误:
Error: unexpected ')' in:
" scale_x_datetime(breaks = date_breaks("2 hour"),labels=date_format("%H:%M")) + xlab("Time 00.00 ~ 24:00 (2007-09-29)") + ylab("Ambient Tempreture")+
opts(title = ("Node i")))"
样本数据属性:
'data.frame': 731 obs. of 2 variables:
$ ambtemp: num 0.23 0.26 0.35 0.31 0.32 0.3 0.36 0.33 0.27 0.27 ...
$ dt : POSIXct, format: "2007-09-29 23:39:05" "2007-09-29 23:41:05" "2007-09-29 23:43:05" ...
样本数据:
温度1:
surtemp date_time
1 0.23 2007-09-29 23:39:05
2 0.26 2007-09-29 23:41:05
3 0.35 2007-09-29 23:43:05
4 0.31 2007-09-29 23:45:05
5 0.32 2007-09-29 23:47:05
6 0.30 2007-09-29 23:49:05
温度2:
surtemp date_time
1 -1.42 2007-09-28 23:39:09
2 -1.24 2007-09-28 23:41:09
3 -1.28 2007-09-28 23:43:09
4 -1.28 2007-09-28 23:45:09
5 -1.24 2007-09-28 23:47:09
6 -1.42 2007-09-28 23:49:09