[Returnanalytics-commits] r2663 - pkg/PortfolioAnalytics/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Mon Jul 29 16:09:45 CEST 2013
Author: rossbennett34
Date: 2013-07-29 16:09:44 +0200 (Mon, 29 Jul 2013)
New Revision: 2663
Modified:
pkg/PortfolioAnalytics/R/constraints.R
Log:
making a few minor revisions/corrections to constraints
Modified: pkg/PortfolioAnalytics/R/constraints.R
===================================================================
--- pkg/PortfolioAnalytics/R/constraints.R 2013-07-29 12:18:31 UTC (rev 2662)
+++ pkg/PortfolioAnalytics/R/constraints.R 2013-07-29 14:09:44 UTC (rev 2663)
@@ -320,6 +320,11 @@
# Get the length of the assets vector
nassets <- length(assets)
+ if(type=="long_only"){
+ min <- rep(0, nassets)
+ max <- rep(1, nassets)
+ }
+
# Check that the length of min and max are the same
if(hasArg(min) | hasArg(max)) {
if (length(min) > 1 & length(max) > 1){
@@ -459,7 +464,7 @@
# Construct group_pos vector
if(!is.null(group_pos)){
# Check the length of the group_pos vector
- if(length(group_poss) != length(groups)) stop("length of group_pos must be equal to the length of groups")
+ if(length(group_pos) != length(groups)) stop("length of group_pos must be equal to the length of groups")
# Check for negative values in group_pos
if(any(group_pos < 0)) stop("all elements of group_pos must be positive")
# Elements of group_pos cannot be greater than groups
More information about the Returnanalytics-commits
mailing list