subsetting in xts using a parameter holding dates

前端 未结 4 770
慢半拍i
慢半拍i 2020-12-18 06:04

I am familiar with the xts subsetting abilities. However, I can\'t find an elegant way to subset a parameterized range of dates. something like this:

<
4条回答
  •  心在旅途
    2020-12-18 06:30

    from the help of [.xts {xts}

    As xts uses POSIXct time representations of all user-level index classes internally, the fastest timeBased subsetting will always be from POSIXct objects, regardless of the indexClass of the original object.

    So you can do subsetting timeBased like this :

    xts.obj[seq(start.date,end.date,by=60)]
                        [,1]
    2012-11-03 09:45:00    1
    

提交回复
热议问题