Skip to content
Prev 299901 / 398503 Next

do I need plyr, apply or something else?

Michael, Mikhail

Many thanks for your helpful comments. My faith in community support continues to grow.

Michael: I'm looking to use some sort of flexible spline-like fit (smooth.spline, lowess etc).


Many thanks for sharing your expertise. I actually cross posted this on to the "manipulatr" google group, here is the response from Peter Meilstrup:

" For (1) you might want to take a look at rollapply() and related functions in the zoo package.
for (2), don't put the different samples of your curve fit into different columns. Instead imagine generating a data frame with three columns:

bae.date (date each your fit is based around) 
prediction.date (date you are extrapolating to)
preciction (the fitted value)

so if you have 100 dates, and generate a 7 point curve from each date, you end up with 700 rows."

As ever time pressures kind of dictate that I start from what I know. I've only pretty basic database skills at the moment, so will try zoo/TTR first and try PostgreSQL if that isn't satisfactory.

-----Original Message-----
From: Mikhail Titov [mailto:mlt at gmx.us] 
Sent: 12 July 2012 00:22
To: R. Michael Weylandt
Cc: Russell Bowdrey; r-help at r-project.org
Subject: Re: do I need plyr, apply or something else?

"R. Michael Weylandt" <michael.weylandt at gmail.com> writes:
I feel like PostgreSQL will do the work better. It has support for basic statistics [1] and you can use window functions [2] to limit the scope for last year only. Then you get your data with RODBC or something.

I suspect you have you data in some sort of DB in the first place. Perhaps it has similar features.

[1] http://www.postgresql.org/docs/9.1/static/functions-aggregate.html#FUNCTIONS-AGGREGATE-STATISTICS-TABLE
[2] http://www.postgresql.org/docs/9.1/interactive/sql-expressions.html#SYNTAX-WINDOW-FUNCTIONS

--
Mikhail


This email and any attachments are confidential and inte...{{dropped:29}}