Reputation: 1088
I have some time series that in the name have a suffix "_edg" in the R environment.
> ls(pattern = "_edg")
[1] "cpi_c_edg" "gc_c_edg" "gdp_c_edg" "t_dep_c_edg"
I want to do this:
e1 <- window(ts.union(cpi_c_edg, gc_c_edg, gdp_c_edg, t_dep_c_edg))
But instead of naming all the series use a code that gets me all the time series with a certain pattern ("_edg") in their name.
Thanks in advance!
Upvotes: 0
Views: 80
Reputation: 887811
Use mget
to return them in a list
window(do.call(ts.union, mget(ls(pattern = "_edg"))))
Upvotes: 1