xts对象的子集列表 [英] subset list of xts objects

查看:83
本文介绍了xts对象的子集列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这里有一篇很棒的文章,其中包含明确设置xts对象的示例:返回另一个时间范围内的数据子集时间范围?

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

但是,我有xts对象的列表,并且我希望通过以下方式对该列表的每个组件进行子集化 从指定日期开始收集所有观察结果.因此,类似这样,但是对于列表中的每个xts对象:

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/"]

感谢您的所有帮助!

推荐答案

您可以使用lapply遍历列表中的所有元素,并使用匿名函数对其进行子集化.

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/"])

这篇关于xts对象的子集列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆