aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--R/build_portfolios.R6
-rw-r--r--R/build_scenarios.R2
2 files changed, 3 insertions, 5 deletions
diff --git a/R/build_portfolios.R b/R/build_portfolios.R
index b51975b1..91fa666e 100644
--- a/R/build_portfolios.R
+++ b/R/build_portfolios.R
@@ -17,7 +17,7 @@ source(file.path(root.dir, "code", "R", "cds_functions_generic.R"))
if(length(args) >=2){
argslist <- strsplit(args[-1], ",")
dealnames <- unlist(lapply(argslist, function(x)x[1]))
- reinvflags <- unlist(lapply(argslist, function(x)x[2]))
+ reinvflags <- as.logical(unlist(lapply(argslist, function(x)x[2])))
}else{
data <- read.table(file.path(root.dir, "scripts", "deals_to_price.txt"),
colClasses=c("character", "logical"))
@@ -51,9 +51,7 @@ currdealnames <- dbGetQuery(dbCon, "select updatedate, dealname from latest_deal
## build portfolio data
for(i in seq_along(dealnames)){
deal.name <- dealnames[i]
- if(exists("disablereinvflags")){
- global.params$reinvflag <- reinvflags[i]
- }
+ global.params$reinvflag <- reinvflags[i]
if(is.na(deal.name)){
next
}
diff --git a/R/build_scenarios.R b/R/build_scenarios.R
index b30bdfbb..95f47ce7 100644
--- a/R/build_scenarios.R
+++ b/R/build_scenarios.R
@@ -24,7 +24,7 @@ if(length(args) >= 1){
if(length(args) >=2){
argslist <- strsplit(args[-1], ",")
dealnames <- unlist(lapply(argslist, function(x)x[1]))
- reinvflags <- unlist(lapply(argslist, function(x)x[2]))
+ reinvflags <- as.logical(unlist(lapply(argslist, function(x)x[2])))
}else{
data <- read.table(file.path(root.dir, "scripts", "deals_to_price.txt"),
colClasses=c("character", "logical"))