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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Aug 26 20:32:27 CEST 2013


Author: rossbennett34
Date: 2013-08-26 20:32:27 +0200 (Mon, 26 Aug 2013)
New Revision: 2895

Modified:
   pkg/PortfolioAnalytics/R/generics.R
Log:
modifying groups section in summary method for optimize.portfolio objects

Modified: pkg/PortfolioAnalytics/R/generics.R
===================================================================
--- pkg/PortfolioAnalytics/R/generics.R	2013-08-26 18:23:57 UTC (rev 2894)
+++ pkg/PortfolioAnalytics/R/generics.R	2013-08-26 18:32:27 UTC (rev 2895)
@@ -553,13 +553,8 @@
     cat("Group Weights:\n")
     n.groups <- length(groups)
     group_weights <- rep(0, n.groups)
-    k <- 1
-    l <- 0
     for(i in 1:n.groups){
-      j <- groups[i]
-      group_weights[i] <- sum(object$weights[k:(l+j)])
-      k <- k + j
-      l <- k - 1
+      group_weights[i] <- sum(weights[groups[[i]]])
     }
     names(group_weights) <- group_labels
     print(group_weights)



More information about the Returnanalytics-commits mailing list