Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201945

How to access data name from a list of time-series in R?

$
0
0

I'm newbie in programming and came across with a problem that I don't know how to solve.

Trying to run some tests in time series, such as adf.test() and kpss.test(). The example above is using adf.test():

library(tseries)

air = ts(AirPassengers)
co2 = ts(co2)
lista = list(air,co2)
table1 = data.frame()

for (i in lista){ table1 = rbind(table1, adf.test(i))}

As a result, it prints:

              statistic parameter alternative   p.value                       method data.name
Dickey-Fuller -7.318571         5  stationary 0.0100000 Augmented Dickey-Fuller Test         i
2             -2.829928         7  stationary 0.2269262 Augmented Dickey-Fuller Test         i

Note that "data.name" prints out "i", instead of "air, co2". Others are correct.

How do I print out "air" and "co2" in my table?


Viewing all articles
Browse latest Browse all 201945

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>