R 用于每日数据的GGSENATIALPLOT不工作

R 用于每日数据的GGSENATIALPLOT不工作,r,time-series,forecasting,ggplot2,R,Time Series,Forecasting,Ggplot2,我是R的新手。 已获取泵的每日数据。数据是两年的,有742个数字 cw<-read.csv("RCW1.csv") str(cw) data.frame': 742 obs. of 14 variables: $ date : Date, format: "2016-04-01" "2016-04-02" "2016-04-03" ... $ amp : num 226 227 0 225 226 ... $ brg_de_tmp : num

我是R的新手。 已获取泵的每日数据。数据是两年的,有742个数字

cw<-read.csv("RCW1.csv")

str(cw)

data.frame':    742 obs. of  14 variables:
 $ date       : Date, format: "2016-04-01" "2016-04-02" "2016-04-03" ...
 $ amp        : num  226 227 0 225 226 ...
 $ brg_de_tmp : num  38.1 38.1 39.6 41.6 41.5 ...
 $ brg_nde_tmp: num  78.6 79.1 72 79.9 80.4 ...
 $ kg         : num  2.07 2.07 0.06 2.29 2.28 2.3 2.11 2.1 2.11 2.11 ...
 $ level1     : num  8.45 8.46 8.69 8.67 8.43 8.6 8.39 8.5 8.46 8.65 ...
 $ level2     : num  8.44 8.46 8.67 8.65 8.42 8.59 8.38 8.48 8.46 8.63 ...
 $ mde_xvib   : num  1.15 1.35 0.28 1.05 1.15 1.06 1.25 1.25 1.25 1.25 ...
 $ mde_zvib   : num  1.37 1.57 0.4 1.18 1.13 1.38 1.28 1.57 1.3 1.5 ...
 $ rpm        : num  296.46 296.91 -4.76 297.09 297.91 ...
 $ mde_yvib   : num  2.09 2.38 0.34 2 1.82 2.24 2.17 2.56 1.9 2.27 ...
 $ m_nde_yvib : num  1.15 1.13 0.35 0.96 0.96 0.96 1.15 1.06 1.15 1.15 ...
 $ m_nde_zvib : num  1.53 1.63 0.27 1.33 1.43 1.4 1.76 1.63 1.79 1.71 ...
 $ permit     : chr  "#N/A" "#N/A" "CW Pump house: Motor stand" "#N/A" ...

看到我在X轴上得到行数,我想改为日期

问题2:我正试图用Robjhyndman的《预测:原理与实践》一书中描述的以下两个代码获得季节图

那么,我如何将我的时间序列输入到上面的代码中呢。当我遇到以下错误时

ggseasonplot(cw_ts, year.labels=TRUE, year.labels.left=TRUE) +
+   ylab("") +
+   ggtitle("Seasonal plot: Pump parameter")
Error in ggseasonplot(cw_ts, year.labels = TRUE, year.labels.left = TRUE) : 
  Data are not seasonal


任何建议都会对我有很大帮助。谢谢。

请看@RobHyndman,我的第一个问题得到了答案。我可以为[p1]编写以下代码,将数据转换为频率等于季节周期长度的ts对象,然后ggseasonplot()将起作用。
autoplot(cw_ts[,2:5],facets = TRUE) + ylab("parameters")
ggseasonplot(cw_ts, year.labels=TRUE, year.labels.left=TRUE) +
ylab("") +
ggtitle("Seasonal plot: Pump parameter")
ggseasonplot(cw_ts, polar=TRUE) +
ylab("") +
ggtitle("Polar seasonal plot: Pump parameter")
ggseasonplot(cw_ts, year.labels=TRUE, year.labels.left=TRUE) +
+   ylab("") +
+   ggtitle("Seasonal plot: Pump parameter")
Error in ggseasonplot(cw_ts, year.labels = TRUE, year.labels.left = TRUE) : 
  Data are not seasonal
 ggseasonplot(cw_ts, polar=TRUE) +
+   ylab("") +
+   ggtitle("Polar seasonal plot: Pump parameter")
Error in ggseasonplot(cw_ts, polar = TRUE) : Data are not seasonal
>