编码如下
library(zoo)
library(tseries)
library(forecast)
x=read.table("D:/ar.txt",header=T)
x=ts(x,start=2001,frequency=1)
plot(x,col=4,lwd=2,pch=8,type="o")
adf.test(x)
Error in adf.test(x) : x is not a vector or univariate time series
我的数据是一列年份一列数据
需要看一下你的数据格式,str(x)