對於已有的Excel中的數據,如何整理成時間序列格式呢?
> setwd("C:\\Users\\Admin-pc\\Desktop")
> time<-read.csv("data1.csv")
> time$b
> a<-ts(time$b, frequency = 1, start = c(1900,1),end = c(1986)) #把數據框的數據變成時間序列, 從1990年開始,到1986年截至
> str(a)
Time-Series [1:87] from 1900 to 1986: 31.7 29.8 31.7 33.1 31.3 ...
#使用Kendall軟件包分析
> library(Kendall)
> MannKendall(a) #P值小於0.01
tau = 0.265, 2-sided pvalue =0.00029208
> plot(a)
> lines(lowess(time(a),a),lwd=3, col=2) #添加趨勢線