[Returnanalytics-commits] r2857 - pkg/PortfolioAnalytics/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Aug 22 20:02:20 CEST 2013


Author: rossbennett34
Date: 2013-08-22 20:02:19 +0200 (Thu, 22 Aug 2013)
New Revision: 2857

Modified:
   pkg/PortfolioAnalytics/R/extract.efficient.frontier.R
Log:
adding the optimal portfolio stats to the extract.efficient.frontier return object

Modified: pkg/PortfolioAnalytics/R/extract.efficient.frontier.R
===================================================================
--- pkg/PortfolioAnalytics/R/extract.efficient.frontier.R	2013-08-22 17:59:17 UTC (rev 2856)
+++ pkg/PortfolioAnalytics/R/extract.efficient.frontier.R	2013-08-22 18:02:19 UTC (rev 2857)
@@ -53,6 +53,8 @@
     
     xtract<-extractStats(object)
     columnnames=colnames(xtract)
+    # optimal portfolio stats from xtract
+    opt <- xtract[which.min(xtract[, "out"]),]
     #if("package:multicore" %in% search() || require("multicore",quietly = TRUE)){
     #    mclapply
     #}
@@ -72,6 +74,8 @@
         tmp<-tmp[which.max(tmp[,'mean']),]
         #tmp
     }
+    # combine the stats from the optimal portfolio to result matrix
+    result <- rbind(opt, result)
     return(result)
 }
 



More information about the Returnanalytics-commits mailing list