[R] apply in zoo
herrdittmann at yahoo.co.uk
Sun Dec 30 15:58:41 CET 2007
Hi R users,
could anyone guide me in the right direction reg. the column-wise
application of a function on a zoo dataframe.
The tseries function sharpe() can only be applied to a univariate time
series. Suppose you have merged the returns of two assets with
set <- merge(log(ibm), log(ge))
is it possible to apply the function sharpe(), in this case with the
since I am using weekly close prices
to the dataset "set" column per column?
I tried apply() with no result:
> apply(set, 2, sharpe(set, scale=sqrt(52)))
Fehler in sharpe(zz) : x is not a vector or univariate time series
In the case of two securities, I could easily do it by hand, but for say
100 or even 500, I am looking for an automated solution.
Many thanks in advance!
More information about the R-help