有非常好的方法来xts对象进行子集化.例如,可以获取所有年,月,日的所有数据,但严格地在上午9:30到下午4点之间执行:
my_xts["T09:30/T16:00"]
Run Code Online (Sandbox Code Playgroud)
或者您可以通过以下方式获得两个日期之间的所有观察:
my_xts["2012-01-01/2012-03-31"]
Run Code Online (Sandbox Code Playgroud)
或者在某个特定日期之前/之后的所有日期:
my_xts["/2011"] # from start of data until end of 2011
my_xts["2011/"] # from 2011 until the end of the data
Run Code Online (Sandbox Code Playgroud)
如何获取所有年份的特定月份或所有月份和年份的特定日期的所有数据?是否存在任何其他子集技巧?