[Returnanalytics-commits] r2312 - pkg/PerformanceAnalytics/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Jan 23 21:19:26 CET 2013


Author: peter_carl
Date: 2013-01-23 21:19:25 +0100 (Wed, 23 Jan 2013)
New Revision: 2312

Modified:
   pkg/PerformanceAnalytics/R/SharpeRatio.R
Log:
- changed apply to sapply to deal with Return.excess and xts attributes


Modified: pkg/PerformanceAnalytics/R/SharpeRatio.R
===================================================================
--- pkg/PerformanceAnalytics/R/SharpeRatio.R	2013-01-23 17:14:25 UTC (rev 2311)
+++ pkg/PerformanceAnalytics/R/SharpeRatio.R	2013-01-23 20:19:25 UTC (rev 2312)
@@ -158,9 +158,9 @@
     for (FUNCT in FUN){
         if (is.null(weights)){
             if(annualize)
-                result[i,] = apply(R, MARGIN=2, FUN=sra, Rf=Rf, p=p, FUNC=FUNCT, ...)
+                result[i,] = sapply(R, FUN=sra, Rf=Rf, p=p, FUNC=FUNCT, ...)
             else
-                result[i,] = apply(R, MARGIN=2, FUN=srm, Rf=Rf, p=p, FUNC=FUNCT, ...)
+                result[i,] = sapply(R, FUN=srm, Rf=Rf, p=p, FUNC=FUNCT, ...)
         }
         else { # TODO FIX this calculation, currently broken
             result[i,] = mean(R%*%weights,na.rm=TRUE)/match.fun(FUNCT)(R, Rf=Rf, p=p, weights=weights, portfolio_method="single", ...=...)



More information about the Returnanalytics-commits mailing list