[Returnanalytics-commits] r3279 - pkg/PortfolioAnalytics/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Mon Dec 16 00:03:29 CET 2013
Author: rossbennett34
Date: 2013-12-16 00:03:28 +0100 (Mon, 16 Dec 2013)
New Revision: 3279
Modified:
pkg/PortfolioAnalytics/R/applyFUN.R
pkg/PortfolioAnalytics/R/extractstats.R
Log:
syntax format in extractStats.optimize.portfolio.ROI and changing applyFUN to explicitly use a function argument instead of dots
Modified: pkg/PortfolioAnalytics/R/applyFUN.R
===================================================================
--- pkg/PortfolioAnalytics/R/applyFUN.R 2013-12-15 23:00:17 UTC (rev 3278)
+++ pkg/PortfolioAnalytics/R/applyFUN.R 2013-12-15 23:03:28 UTC (rev 3279)
@@ -9,8 +9,8 @@
#' @param ... any passthrough arguments to FUN
#' @author Ross Bennett
#' @export
-applyFUN <- function(R, weights, FUN="mean", ...){
- nargs <- list(...)
+applyFUN <- function(R, weights, FUN="mean", arguments){
+ nargs <- arguments
moments <- function(R){
momentargs <- list()
@@ -95,8 +95,8 @@
#' @param ... any passthrough arguments to FUN
#' @author Ross Bennett
#' @export
-scatterFUN <- function(R, FUN, ...){
- nargs <- list(...)
+scatterFUN <- function(R, FUN, arguments){
+ nargs <- arguments
# match the FUN arg to a risk or return function
switch(FUN,
Modified: pkg/PortfolioAnalytics/R/extractstats.R
===================================================================
--- pkg/PortfolioAnalytics/R/extractstats.R 2013-12-15 23:00:17 UTC (rev 3278)
+++ pkg/PortfolioAnalytics/R/extractstats.R 2013-12-15 23:03:28 UTC (rev 3279)
@@ -215,13 +215,14 @@
#' @export
extractStats.optimize.portfolio.ROI <- function(object, prefix=NULL, ...) {
if(!inherits(object, "optimize.portfolio.ROI")) stop("object must be of class optimize.portfolio.ROI")
- trow<-c(out=object$out, object$weights)
-
+ trow <- c(object$out, object$weights)
objmeas <- extractObjectiveMeasures(object)
objnames <- names(objmeas)
obj <- unlist(objmeas)
result <- c(obj, trow)
- rnames<-c(objnames, 'out',paste('w',names(object$weights),sep='.'))
+ rnames<-c(objnames, 'out', paste('w', names(object$weights), sep='.'))
+ #print(result)
+ #print(rnames)
names(result)<-rnames
return(result)
}
More information about the Returnanalytics-commits
mailing list