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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Feb 20 23:49:06 CET 2014


Author: rossbennett34
Date: 2014-02-20 23:49:06 +0100 (Thu, 20 Feb 2014)
New Revision: 3319

Modified:
   pkg/PortfolioAnalytics/R/charts.efficient.frontier.R
Log:
Modifying chart.EfficientFrontierOverlay to use portfolio.list

Modified: pkg/PortfolioAnalytics/R/charts.efficient.frontier.R
===================================================================
--- pkg/PortfolioAnalytics/R/charts.efficient.frontier.R	2014-02-20 18:24:47 UTC (rev 3318)
+++ pkg/PortfolioAnalytics/R/charts.efficient.frontier.R	2014-02-20 22:49:06 UTC (rev 3319)
@@ -518,7 +518,8 @@
 #' Overlay the efficient frontiers of multiple portfolio objects on a single plot.
 #' 
 #' @param R an xts object of asset returns
-#' @param portfolio_list list of portfolio objects created by \code{\link{portfolio.spec}}
+#' @param portfolio_list list of portfolio objects created by 
+#' \code{\link{portfolio.spec}} and combined with \code{\link{combine.portfolios}}
 #' @param type type of efficient frontier, see \code{\link{create.EfficientFrontier}}
 #' @param n.portfolios number of portfolios to extract along the efficient frontier.
 #' This is only used for objects of class \code{optimize.portfolio}
@@ -545,7 +546,7 @@
 #' @export
 chart.EfficientFrontierOverlay <- function(R, portfolio_list, type, n.portfolios=25, match.col="ES", search_size=2000, main="Efficient Frontiers", cex.axis=0.8, element.color="darkgray", legend.loc=NULL, legend.labels=NULL, cex.legend=0.8, xlim=NULL, ylim=NULL, ..., chart.assets=TRUE, labels.assets=TRUE, pch.assets=21, cex.assets=0.8, col=NULL, lty=NULL, lwd=NULL){
   # create multiple efficient frontier objects (one per portfolio in portfolio_list)
-  if(!is.list(portfolio_list)) stop("portfolio_list must be passed in as a list")
+  if(!inherits(portfolio_list, "portfolio.list")) stop("portfolio_list must be passed in as a list")
   if(length(portfolio_list) == 1) warning("Only one portfolio object in portfolio_list")
   # store in out
   out <- list()



More information about the Returnanalytics-commits mailing list