[R] rollapply() by time, not entries (width)

Joshua Ulrich josh.m.ulrich at gmail.com
Sat Oct 27 16:08:35 CEST 2012


On Sat, Oct 27, 2012 at 6:52 AM, R. Michael Weylandt
<michael.weylandt at gmail.com> wrote:
> I might suggest you take a look at period.apply() in the xts package.
>
I don't think that will work because it sounds like "J" wants analysis
on overlapping intervals, and period.apply works on non-overlapping
intervals.  I'd suggest using a for loop with the window() function.
But be careful about timezone and DST issues if your data is more
frequent than daily.

> Cheers,
> Michael
>

Best,
--
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com


> On Fri, Oct 26, 2012 at 7:33 PM, Jaguar83 <jagelfand at gmail.com> wrote:
>> Hi all-
>>
>> Thank you for reading my post. Please bear in mind that I'm very much a
>> newbie with R! My question is this:
>>
>> I'm trying to use rollapply() on an irregular time series so I can't simply
>> use the width parameter (I don't think). Rather than last 5 entries, I'd
>> like to rollapply on last 6 months (for example). What would be the proper
>> course of action for this?
>>
>> Thanks!
>>
>> -J
>>
>>
>>
>> --
>> View this message in context: http://r.789695.n4.nabble.com/rollapply-by-time-not-entries-width-tp4647586.html
>> Sent from the R help mailing list archive at Nabble.com.
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.




More information about the R-help mailing list