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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Sep 7 21:45:19 CEST 2013


Author: rossbennett34
Date: 2013-09-07 21:45:19 +0200 (Sat, 07 Sep 2013)
New Revision: 3021

Modified:
   pkg/PortfolioAnalytics/R/generics.R
Log:
Modifying generic functions to round weights for printing.

Modified: pkg/PortfolioAnalytics/R/generics.R
===================================================================
--- pkg/PortfolioAnalytics/R/generics.R	2013-09-07 14:58:14 UTC (rev 3020)
+++ pkg/PortfolioAnalytics/R/generics.R	2013-09-07 19:45:19 UTC (rev 3021)
@@ -254,7 +254,7 @@
   
   # get optimal weights
   cat("Optimal Weights:\n")
-  print.default(x$weights, digits=digits)
+  print.default(round(x$weights, digits=digits), digits=digits)
   cat("\n")
   
   # get objective measure
@@ -301,7 +301,7 @@
   
   # get optimal weights
   cat("Optimal Weights:\n")
-  print.default(x$weights, digits=digits)
+  print.default(round(x$weights, digits=digits), digits=digits)
   cat("\n")
   
   # get objective measures
@@ -348,7 +348,7 @@
   
   # get optimal weights
   cat("Optimal Weights:\n")
-  print.default(x$weights, digits=digits)
+  print.default(round(x$weights, digits=digits), digits=digits)
   cat("\n")
   
   # get objective measures
@@ -395,7 +395,7 @@
   
   # get optimal weights
   cat("Optimal Weights:\n")
-  print.default(x$weights, digits=digits)
+  print.default(round(x$weights, digits=digits), digits=digits)
   cat("\n")
   
   # get objective measures
@@ -442,7 +442,7 @@
   
   # get optimal weights
   cat("Optimal Weights:\n")
-  print.default(x$weights, digits=digits)
+  print.default(round(x$weights, digits=digits), digits=digits)
   cat("\n")
   
   # get objective measures
@@ -490,7 +490,7 @@
   
   # get optimal weights
   cat("Optimal Weights:\n")
-  print.default(object$weights)
+  print.default(round(object$weights, digits=4))
   cat("\n")
   
   # objective measures
@@ -742,7 +742,7 @@
   colnames(wts) <- gsub("w.", "", colnames(wts))
   rownames(wts) <- 1:nrow(object$frontier)
   cat("Weights along the efficient frontier:\n")
-  print(wts)
+  print(round(wts, digits=digits))
   cat("\n")
   
   # Risk and return



More information about the Returnanalytics-commits mailing list