[R-SIG-Finance] subsetting based on date and time of an xts?

Raghuraman Ramachandran optionsraghu at gmail.com
Thu Oct 2 13:38:40 CEST 2014


guRus

My sincere apologies for rushing into this question! I realised this
is as simple as

res1=res["T14:30:00/T21:15:00"]

Many thanks
R

On Thu, Oct 2, 2014 at 12:24 PM, Raghuraman Ramachandran
<optionsraghu at gmail.com> wrote:
> Dear guRus
>
> I have an xts variable res which is as below:
>
>>str(res)
> An ‘xts’ object on 2014-09-03 23:30:00/2014-10-01 21:45:00 containing:
>   Data: num [1:1837, 1] 1991 1991 1991 1991 1991 ...
>  - attr(*, "dimnames")=List of 2
>   ..$ : NULL
>   ..$ : chr "Data"
>   Indexed by objects of class: [POSIXct,POSIXt] TZ:
>   xts Attributes:
> List of 4
>  $ from   : chr "20140911  22:00:00"
>  $ to     : chr "20141001  22:00:00"
>  $ src    : chr "IB"
>  $ updated: POSIXct[1:1], format: "2014-10-02 10:59:31.125498"
>
> How do I build a new xts out of this which is a time series that
> starts and ends at particular times everyday. As an example if I want
> the data series to start at 2014-09-03 14:30:00 and end at 2014-09-03
> 21:15:00 and then continue with 2014-09-04 14:30:00 and end at
> 2014-09-04 21:15:00 and so on please?
>
> Basically I am trying to rbind multilple subsets of the xts data based
> on time everyday.
>
> Many thanks for the kind assistance,
> R



More information about the R-SIG-Finance mailing list