1
votes

There's a great post on here that has clear examples of subsetting an xts object: Return data subset time frames within another timeframes?

However, I have list of xts objects and I am looking to subset each component of this list by gathering all the observations from a specified date onward. So, something like this, but for each xts object in the list:

my_xts["2011/"]

Thank you for all your help!

1
Can't you just use lapply(xts_list, function(x) x["2011/"])? - Joshua Ulrich
thank you! i hadn't thought about making a "function". this is a good solution, wish i could give you more points - jonnie

1 Answers

1
votes

You can use lapply to loop over all the elements in your list, and use an anonymous function to subset them.

lapply(xts_list, function(x) x["2011/"])