[R-SIG-Finance] "Package", please ...

Gabor Grothendieck ggrothendieck at gmail.com
Fri Mar 12 15:14:09 CET 2010


rollapply is part of the zoo package and it is intended to both input
and output a zoo object.  There are zoo and zooreg methods.  If you
use rollapply then the usual S3 method search applies.

Thus if the first arg is an xts object then such an object has a class
vector of c("xts", "zoo") so rollapply.zoo gets used.

On Fri, Mar 12, 2010 at 12:42 AM, Robert Nicholson
<robert.nicholson at gmail.com> wrote:
> Why isn't zoo rollapply written to take the return type? Why do you have to wrap the return value?
>
> if I start with an xts and rollapply I get a zoo and I'm required to wrap in an as.xts so why couldn't rollapply
> be written to accept the return value or derive the return value from the type of data?
>
> On Mar 5, 2010, at 10:16 AM, Martin Maechler wrote:
>
>>>>>>> "Jm" == Judson m <judsonm123 at yahoo.com>
>>>>>>>    on Fri, 5 Mar 2010 06:17:49 -0800 (PST) writes:
>>
>>>> Here was a naive attempt to do standard deviation with
>>>> sliding window
>>>>> require(quantmod) getSymbols("AAPL") AAPL$STDDEV =
>>>>> sd(Cl(AAPL), 20) AAPL$SMA = SMA(Cl(AAPL), 10) AAPL
>>
>>    Jm> I am pretty sure that rollapply in the ZOO library would
>>    Jm> work for you.
>>
>> There's neither "ZOO" nor would that be "library".
>>
>> It is   "zoo"   and it  is a *package*.
>>
>> Martin Maechler, ETH Zurich
>
> _______________________________________________
> R-SIG-Finance at stat.math.ethz.ch 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