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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Jul 19 04:33:33 CEST 2013


Author: rossbennett34
Date: 2013-07-19 04:33:33 +0200 (Fri, 19 Jul 2013)
New Revision: 2599

Modified:
   pkg/PortfolioAnalytics/R/constraints.R
Log:
fixing error with parens in position_limit_constraint

Modified: pkg/PortfolioAnalytics/R/constraints.R
===================================================================
--- pkg/PortfolioAnalytics/R/constraints.R	2013-07-19 02:23:32 UTC (rev 2598)
+++ pkg/PortfolioAnalytics/R/constraints.R	2013-07-19 02:33:33 UTC (rev 2599)
@@ -659,7 +659,7 @@
   
   # Checks for max_pos
   if(!is.null(max_pos)){
-    if(length(max_pos != 1)) stop("max_pos must be a scalar value of length 1")
+    if(length(max_pos) != 1) stop("max_pos must be a scalar value of length 1")
     if(max_pos < 0) stop("max_pos must be a positive value")
     if(max_pos > nassets){
       message("max_pos must be less than or equal to the number of assets")
@@ -671,7 +671,7 @@
   
   # Checks for max_pos_long
   if(!is.null(max_pos_long)){
-    if(length(max_pos_long != 1)) stop("max_pos_long must be a scalar value of length 1")
+    if(length(max_pos_long) != 1) stop("max_pos_long must be a scalar value of length 1")
     if(max_pos_long < 0) stop("max_pos_long must be a positive value")
     if(max_pos_long > nassets){
       message("max_pos_long must be less than or equal to the number of assets")
@@ -683,7 +683,7 @@
   
   # Checks for max_pos_short
   if(!is.null(max_pos_short)){
-    if(length(max_pos_short != 1)) stop("max_pos_short must be a scalar value of length 1")
+    if(length(max_pos_short) != 1) stop("max_pos_short must be a scalar value of length 1")
     if(max_pos_short < 0) stop("max_pos_short must be a positive value")
     if(max_pos_short > nassets){
       message("max_pos_short must be less than or equal to the number of assets")



More information about the Returnanalytics-commits mailing list