[Returnanalytics-commits] r2763 - in pkg/PortfolioAnalytics: R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Aug 11 04:34:25 CEST 2013


Author: rossbennett34
Date: 2013-08-11 04:34:20 +0200 (Sun, 11 Aug 2013)
New Revision: 2763

Modified:
   pkg/PortfolioAnalytics/R/charts.RP.R
   pkg/PortfolioAnalytics/man/charts.RP.Rd
   pkg/PortfolioAnalytics/man/plot.optimize.portfolio.random.Rd
Log:
modifying chart methods for optimize.portfolio.random objects for chart.Scatter.RP to plot other risk or return metrics not specified in objective measures

Modified: pkg/PortfolioAnalytics/R/charts.RP.R
===================================================================
--- pkg/PortfolioAnalytics/R/charts.RP.R	2013-08-10 14:15:12 UTC (rev 2762)
+++ pkg/PortfolioAnalytics/R/charts.RP.R	2013-08-11 02:34:20 UTC (rev 2763)
@@ -246,6 +246,7 @@
 #' \code{risk.col},\code{return.col}, and weights columns all properly named.  
 #' 
 #' @param RP set of random portfolios created by \code{\link{optimize.portfolio}}
+#' @param R an optional xts, vector, matrix, data frame, timeSeries or zoo 
 #' @param ... any other passthru parameters 
 #' @param risk.col string name of column to use for risk (horizontal axis)
 #' @param return.col string name of column to use for returns (vertical axis)
@@ -255,14 +256,14 @@
 #' \code{\link{optimize.portfolio}}
 #' \code{\link{extractStats}}
 #' @export
-charts.RP <- function(RP, risk.col, return.col, 
+charts.RP <- function(RP, R=NULL, risk.col, return.col, 
 						neighbors=NULL, main="Random.Portfolios", ...){
 # Specific to the output of the random portfolio code with constraints
     # @TODO: check that RP is of the correct class
     op <- par(no.readonly=TRUE)
     layout(matrix(c(1,2)),height=c(2,1.5),width=1)
     par(mar=c(4,4,4,2))
-    chart.Scatter.RP(RP, risk.col=risk.col, return.col=return.col, neighbors=neighbors, main=main, ...)
+    chart.Scatter.RP(RP, R=R, risk.col=risk.col, return.col=return.col, neighbors=neighbors, main=main, ...)
     par(mar=c(2,4,0,2))
     chart.Weights.RP(RP, main="", neighbors=neighbors, ...)
     par(op)
@@ -284,13 +285,14 @@
 #' \code{risk.col},\code{return.col}, and weights columns all properly named.  
 #' @param x set of portfolios created by \code{\link{optimize.portfolio}}
 #' @param ... any other passthru parameters 
+#' @param R an optional an xts, vector, matrix, data frame, timeSeries or zoo 
 #' @param risk.col string name of column to use for risk (horizontal axis)
 #' @param return.col string name of column to use for returns (vertical axis)
 #' @param neighbors set of 'neighbor portfolios to overplot
 #' @param main an overall title for the plot: see \code{\link{title}}
 #' @export
-plot.optimize.portfolio.random <- function(x, ...,  return.col='mean', risk.col='ES',  neighbors=NULL, main='optimized portfolio plot') {
-    charts.RP(RP=x, risk.col=risk.col, return.col=return.col, neighbors=neighbors, main=main, ...)
+plot.optimize.portfolio.random <- function(x, ...,  R=NULL, return.col='mean', risk.col='ES',  neighbors=NULL, main='optimized portfolio plot') {
+    charts.RP(RP=x, R=R, risk.col=risk.col, return.col=return.col, neighbors=neighbors, main=main, ...)
 }
 
 #' plot method for optimize.portfolio output

Modified: pkg/PortfolioAnalytics/man/charts.RP.Rd
===================================================================
--- pkg/PortfolioAnalytics/man/charts.RP.Rd	2013-08-10 14:15:12 UTC (rev 2762)
+++ pkg/PortfolioAnalytics/man/charts.RP.Rd	2013-08-11 02:34:20 UTC (rev 2763)
@@ -2,13 +2,16 @@
 \alias{charts.RP}
 \title{scatter and weights chart  for random portfolios}
 \usage{
-  charts.RP(RP, risk.col, return.col, neighbors = NULL,
-    main = "Random.Portfolios", ...)
+  charts.RP(RP, R = NULL, risk.col, return.col,
+    neighbors = NULL, main = "Random.Portfolios", ...)
 }
 \arguments{
   \item{RP}{set of random portfolios created by
   \code{\link{optimize.portfolio}}}
 
+  \item{R}{an optional xts, vector, matrix, data frame,
+  timeSeries or zoo}
+
   \item{...}{any other passthru parameters}
 
   \item{risk.col}{string name of column to use for risk

Modified: pkg/PortfolioAnalytics/man/plot.optimize.portfolio.random.Rd
===================================================================
--- pkg/PortfolioAnalytics/man/plot.optimize.portfolio.random.Rd	2013-08-10 14:15:12 UTC (rev 2762)
+++ pkg/PortfolioAnalytics/man/plot.optimize.portfolio.random.Rd	2013-08-11 02:34:20 UTC (rev 2763)
@@ -2,7 +2,7 @@
 \alias{plot.optimize.portfolio.random}
 \title{plot method for optimize.portfolio.random output}
 \usage{
-  plot.optimize.portfolio.random(x, ...,
+  plot.optimize.portfolio.random(x, ..., R = NULL,
     return.col = "mean", risk.col = "ES", neighbors = NULL,
     main = "optimized portfolio plot")
 }
@@ -12,6 +12,9 @@
 
   \item{...}{any other passthru parameters}
 
+  \item{R}{an optional an xts, vector, matrix, data frame,
+  timeSeries or zoo}
+
   \item{risk.col}{string name of column to use for risk
   (horizontal axis)}
 



More information about the Returnanalytics-commits mailing list