[R-SIG-Finance] select subset from xts time series object.
Jeff Ryan
jeff.a.ryan at gmail.com
Sat Apr 16 19:11:44 CEST 2011
Very close.
Try:
ticks[' 2010-08-04 11:50:00/2010-08-04 11:55:00' , ]
The subsetting works off of one string, your were applying the : operator in R to a character string instead.
HTH
Jeff
Jeffrey Ryan | Founder | jeffrey.ryan at lemnica.com
www.lemnica.com
On Apr 16, 2011, at 12:01 PM, Noah Silverman <noah at smartmediacorp.com> wrote:
> Hi,
>
> Thanks to Jeff Ryan's help, I was able to get my data into a nice XTS format. I then followed his suggestion to use the make.index.unique() function to ensure that each tick had a slightly different time. Everything looks great!
>
> Now, I want to select subsets of the data for short intervals - perhaps 5 minutes in size.
>
> For example, I want all the entries between:
> 2010-08-04 11:50:00 and 2010-08-04 11:55:00
>
> I tried: ticks[' 2010-08-04 11:50:00' :'2010-08-04 11:55:00' , ] It failed
> Then: ticks[as.POSIXct(' 2010-08-04 11:50:00') : asPOSIXct('2010-08-04 11:55:00' ), ] Also fails
>
> Can anyone point me in the right direction?
>
> Thanks!
>
> --
> Noah Silverman
> Smart Media Corp.
> WebClipping.com
> Tel: (323) 653-1900 x5207
>
> _______________________________________________
> R-SIG-Finance at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions should go.
More information about the R-SIG-Finance
mailing list