diff options
| -rw-r--r-- | R/build_portfolios.R | 17 | ||||
| -rw-r--r-- | R/build_scenarios.R | 4 |
2 files changed, 6 insertions, 15 deletions
diff --git a/R/build_portfolios.R b/R/build_portfolios.R index f027d06e..b51975b1 100644 --- a/R/build_portfolios.R +++ b/R/build_portfolios.R @@ -19,13 +19,10 @@ if(length(args) >=2){ dealnames <- unlist(lapply(argslist, function(x)x[1]))
reinvflags <- unlist(lapply(argslist, function(x)x[2]))
}else{
- data <- read.table(file.path(root.dir, "scripts", "cusips_to_price.txt"))
- dealnames <- dealnamefromcusip(data$V1)
- uniqdealnames <- unique(dealnames)
- uniqdealnames <- uniqdealnames[!is.na(uniqdealnames)]
- reinvflags <- data$V2[match(uniqdealnames, dealnames)]
- dealnames <- uniqdealnames
- unlink(file.path(root.dir, "scripts", "cusips_to_price.txt"))
+ data <- read.table(file.path(root.dir, "scripts", "deals_to_price.txt"),
+ colClasses=c("character", "logical"))
+ dealnames <- data$V1
+ reinvflags <- data$V2
}
if(length(args) >= 1){
@@ -114,9 +111,3 @@ for(i in seq_along(dealnames)){ currdealnames <- c(currdealnames, deal.name)
}
}
-
-if(length(args)<1){
- write.table(data.frame(dealnames, as.logical(reinvflags)),
- file = file.path(root.dir, "scripts", "scenarios.txt"),
- row.names = F, col.names = F, quote = F)
-}
diff --git a/R/build_scenarios.R b/R/build_scenarios.R index ea0f473e..b30bdfbb 100644 --- a/R/build_scenarios.R +++ b/R/build_scenarios.R @@ -26,11 +26,11 @@ if(length(args) >=2){ dealnames <- unlist(lapply(argslist, function(x)x[1]))
reinvflags <- unlist(lapply(argslist, function(x)x[2]))
}else{
- data <- read.table(file.path(root.dir, "scripts", "scenarios.txt"),
+ data <- read.table(file.path(root.dir, "scripts", "deals_to_price.txt"),
colClasses=c("character", "logical"))
dealnames <- data$V1
reinvflags <- data$V2
- unlink(file.path(root.dir, "scripts", "scenarios.txt"))
+ unlink(file.path(root.dir, "scripts", "deals_to_price.txt"))
}
source(file.path(root.dir, "code", "R", "intex_deal_functions.R"))
|
