I am trying to apply adf.test to all columns of a dataframe. Some columns have NA values. I would like to store the output in a vector/list/dataframe.
H<-data.frame(replicate(10,sample(0:20,10,rep=TRUE)))
H[c(2,3,7,9),9]<-NA
H[c(1,4,8),2]<-NA
H[c(1,2,3,4,8),4]<-NA
I get errors as below
oi<-adf.test(H,alternative="stationary")
Error in adf.test(H, alternative = "stationary") :
x is not a vector or univariate time series
lapply(na.omit(H),adf.test)
Error in res.sum$coefficients[2, 1] : subscript out of bounds
Package: tseries
Help is appreciated