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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Aug 16 18:27:25 CEST 2013


Author: rossbennett34
Date: 2013-08-16 18:27:25 +0200 (Fri, 16 Aug 2013)
New Revision: 2797

Modified:
   pkg/PortfolioAnalytics/R/portfolio.R
   pkg/PortfolioAnalytics/man/portfolio.spec.Rd
Log:
Adding documentation for portfolio.spec

Modified: pkg/PortfolioAnalytics/R/portfolio.R
===================================================================
--- pkg/PortfolioAnalytics/R/portfolio.R	2013-08-16 11:08:26 UTC (rev 2796)
+++ pkg/PortfolioAnalytics/R/portfolio.R	2013-08-16 16:27:25 UTC (rev 2797)
@@ -12,12 +12,30 @@
 
 #' constructor for class portfolio
 #' 
+#' The portfolio object is created with \code{portfolio.spec}. The portfolio
+#' object is an S3 object of class 'portfolio' used to hold the seed assets,
+#' constraints, objectives, and other information about the portfolio. The only
+#' required argument to \code{portfolio.spec} is \code{assets}.
+#' 
+#' The portfolio object contains the following elements:
+#' \itemize{
+#' \item{\code{assets}}{ named vector of the seed weights}
+#' \item{\code{category_labels}}{ character vector to categorize the assets by sector, geography, etc.}
+#' \item{\code{weight_seq}}{ sequence of weights used by \code{\link{random_portfolios}}. See \code{\link{generatesequence}}}
+#' \item{\code{constraints}}{ a list of constraints added to the portfolio object with \code{\link{add.constraint}}}
+#' \item{\code{objectives}}{ a list of objectives added to the portfolio object with \code{\link{add.objective}}}
+#' \item{\code{call}}{ the call to \code{portfolio.spec} with all of the specified arguments}
+#' }
+#' 
 #' @param assets number of assets, or optionally a named vector of assets specifying seed weights. If seed weights are not specified, an equal weight portfolio will be assumed.
-#' @param category_labels character vector to categorize assets by sector, industry, geography, market-cap, currency, etc.
-#' @param weight_seq seed sequence of weights, see \code{\link{generatesequence}}
+#' @param category_labels character vector to categorize assets by sector, industry, geography, market-cap, currency, etc. Default NULL
+#' @param weight_seq seed sequence of weights, see \code{\link{generatesequence}} Default NULL
 #' @param message TRUE/FALSE. The default is message=FALSE. Display messages if TRUE.
+#' @return an object of class \code{portfolio}
 #' @author Ross Bennett
 #' @examples 
+#' data(edhec)
+#' pspec <- portfolio.spec(assets=colnames(edhec))
 #' pspec <- portfolio.spec(assets=10, weight_seq=generatesequence())
 #' @export
 portfolio.spec <- function(assets=NULL, category_labels=NULL, weight_seq=NULL, message=FALSE) {

Modified: pkg/PortfolioAnalytics/man/portfolio.spec.Rd
===================================================================
--- pkg/PortfolioAnalytics/man/portfolio.spec.Rd	2013-08-16 11:08:26 UTC (rev 2796)
+++ pkg/PortfolioAnalytics/man/portfolio.spec.Rd	2013-08-16 16:27:25 UTC (rev 2797)
@@ -13,18 +13,43 @@
 
   \item{category_labels}{character vector to categorize
   assets by sector, industry, geography, market-cap,
-  currency, etc.}
+  currency, etc. Default NULL}
 
   \item{weight_seq}{seed sequence of weights, see
-  \code{\link{generatesequence}}}
+  \code{\link{generatesequence}} Default NULL}
 
   \item{message}{TRUE/FALSE. The default is message=FALSE.
   Display messages if TRUE.}
 }
+\value{
+  an object of class \code{portfolio}
+}
 \description{
-  constructor for class portfolio
+  The portfolio object is created with
+  \code{portfolio.spec}. The portfolio object is an S3
+  object of class 'portfolio' used to hold the seed assets,
+  constraints, objectives, and other information about the
+  portfolio. The only required argument to
+  \code{portfolio.spec} is \code{assets}.
 }
+\details{
+  The portfolio object contains the following elements:
+  \itemize{ \item{\code{assets}}{ named vector of the seed
+  weights} \item{\code{category_labels}}{ character vector
+  to categorize the assets by sector, geography, etc.}
+  \item{\code{weight_seq}}{ sequence of weights used by
+  \code{\link{random_portfolios}}. See
+  \code{\link{generatesequence}}}
+  \item{\code{constraints}}{ a list of constraints added to
+  the portfolio object with \code{\link{add.constraint}}}
+  \item{\code{objectives}}{ a list of objectives added to
+  the portfolio object with \code{\link{add.objective}}}
+  \item{\code{call}}{ the call to \code{portfolio.spec}
+  with all of the specified arguments} }
+}
 \examples{
+data(edhec)
+pspec <- portfolio.spec(assets=colnames(edhec))
 pspec <- portfolio.spec(assets=10, weight_seq=generatesequence())
 }
 \author{



More information about the Returnanalytics-commits mailing list