Skip to content

rollapply() by time, not entries (width)

3 messages · Jaguar83, R. Michael Weylandt, Joshua Ulrich

#
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.
#
I might suggest you take a look at period.apply() in the xts package.

Cheers,
Michael
On Fri, Oct 26, 2012 at 7:33 PM, Jaguar83 <jagelfand at gmail.com> wrote:
#
On Sat, Oct 27, 2012 at 6:52 AM, R. Michael Weylandt
<michael.weylandt at gmail.com> wrote:
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.
Best,
--
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com