Augmented Dickey-Fuller Test/ Unit Root test on multiple time series dataframe in R

I have a dataset/dataframe in which I have calculated the daily log returns of five thousand companies and these companies are as column as well. I want carry out ADF test on this dataframe. I have found how to estimate ADF test on vector but could not find how to calculate it on dataframe or matrix structure. Additionally how can I leave out the date column when estimating ADF test on the companies.

The picture illustrates some portion of my dataset. The code I ran and error I received are as follows

library(tseries)
k = trunc((length(1)-1)^(1/3)))

Error in adf.test(logs, alternative = c("stationary", "explosive"), k = trunc((length(1) -  :  x is not a vector or univariate time series

• I did not downvote your question but I can understand why somebody did: Please show your code and pinpoint exactly to the parts where you encounter problems. – vonjd Dec 30 '15 at 10:54
• I hope this additions to the question helps to understand what I'm trying to estimate. – Aquarius Dec 30 '15 at 11:07

There a to ways that you can performe the ADF test to a data frame, first write a loop for applying the test to all the columns or use the apply function to your data. For leaving out the first column just create an other data frame like this: da=yourDataName[,-1]. the code for the ADF would be something like apply(da,2,adfTest,lags=0,type="c"). The 2 is saying that the function adfTest should be apply to the columns, the adfTest is from the package fUnitRoots, lags=0 so it does not perform the test lagging the series and type="c" so it includes a constant. I don't like the test from timeSeries package because it will lag the series automatically so you will get "always" a stationary series.
• I ran the test according to the code you specifiied but I recieved error Error in res.sum\$coefficients[coefNum, 1] : subscript out of bounds – Aquarius Jan 4 '16 at 11:46