[Returnanalytics-commits] r3378 - in pkg/PortfolioAnalytics: R vignettes

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Apr 28 23:43:21 CEST 2014


Author: rossbennett34
Date: 2014-04-28 23:43:21 +0200 (Mon, 28 Apr 2014)
New Revision: 3378

Modified:
   pkg/PortfolioAnalytics/R/charts.DE.R
   pkg/PortfolioAnalytics/R/charts.risk.R
   pkg/PortfolioAnalytics/vignettes/DesignThoughts.Rnw
Log:
Minor fix to charting functions Add index entry to vignette

Modified: pkg/PortfolioAnalytics/R/charts.DE.R
===================================================================
--- pkg/PortfolioAnalytics/R/charts.DE.R	2014-04-27 02:53:24 UTC (rev 3377)
+++ pkg/PortfolioAnalytics/R/charts.DE.R	2014-04-28 21:43:21 UTC (rev 3378)
@@ -226,7 +226,7 @@
     # Only attempt to draw trajectory if rows is greater than or equal to 1
     # There may be some corner cases where nrow(w.traj) is equal to 0, 
     # resulting in a 'subscript out of bounds' error.
-    if(rows >= 1){
+    if(rows >= 2){
       rr = matrix(nrow=rows, ncol=2)
       ## maybe rewrite as an apply statement by row on w.traj
       rtc = NULL

Modified: pkg/PortfolioAnalytics/R/charts.risk.R
===================================================================
--- pkg/PortfolioAnalytics/R/charts.risk.R	2014-04-27 02:53:24 UTC (rev 3377)
+++ pkg/PortfolioAnalytics/R/charts.risk.R	2014-04-28 21:43:21 UTC (rev 3378)
@@ -221,6 +221,7 @@
     rbcols <- grep(paste(match.col, "contribution", sep="."), colnames(rebal.obj))
     if(length(rbcols) < 1) stop(paste("No ", match.col, ".contribution columns.", sep=""))
     rbdata <- rebal.obj[, rbcols]
+    colnames(rbdata) <- gsub("^.*\\.", "", colnames(rbdata))
     chart.StackedBar(w=rbdata, ylab=paste(match.col, "Contribution", sep=" "), main=main, ...)
   }
   
@@ -228,6 +229,7 @@
     rbcols <- grep(paste(match.col, "pct_contrib", sep="."), colnames(rebal.obj))
     if(length(rbcols) < 1) stop(paste("No ", match.col, ".pct_contrib columns.", sep=""))
     rbdata <- rebal.obj[, rbcols]
+    colnames(rbdata) <- gsub("^.*\\.", "", colnames(rbdata))
     chart.StackedBar(w=rbdata, ylab=paste(match.col, "% Contribution", sep=" "), main=main, ...)
   }
 }

Modified: pkg/PortfolioAnalytics/vignettes/DesignThoughts.Rnw
===================================================================
--- pkg/PortfolioAnalytics/vignettes/DesignThoughts.Rnw	2014-04-27 02:53:24 UTC (rev 3377)
+++ pkg/PortfolioAnalytics/vignettes/DesignThoughts.Rnw	2014-04-28 21:43:21 UTC (rev 3378)
@@ -67,6 +67,8 @@
 
 \newcommand{\comm}[1]{\begin{quote}{\large \bf (#1)}\end{quote}}
 
+% \VignetteIndexEntry{Design Thoughts of the PortfolioAnalytics Package}
+
 \begin{document}
 \vspace{-2cm}
 %\baselineskip=20pt



More information about the Returnanalytics-commits mailing list