aboutsummaryrefslogtreecommitdiffstats
path: root/R
diff options
context:
space:
mode:
Diffstat (limited to 'R')
-rw-r--r--R/load_cf.R11
1 files changed, 6 insertions, 5 deletions
diff --git a/R/load_cf.R b/R/load_cf.R
index 5e1819b8..07b1a960 100644
--- a/R/load_cf.R
+++ b/R/load_cf.R
@@ -44,12 +44,13 @@ if(length(args)>=2){
cusips <- args[-1]
dealnames <- unique(dealnamefromcusip(cusips))
}else{
- allfiles <- list.files(file.path(root.dir, "Scenarios", paste0("Prices_", workdate)), "*.txt")
- allfiles <- unique(sapply(strsplit(allfiles, "-"), function(x) x[1]))
+ pricesdir <- file.path(root.dir, "Scenarios", paste0("Prices_", workdate))
+ allfiles <- list.files(pricesdir, "*.txt")
+ allfiles <- unique(vapply(strsplit(allfiles, "-"), function(x) x[1], character(1)))
allfiles <- allfiles[!(allfiles=="Total")]
- dealnames <- list.files(file.path(root.dir, "Scenarios", paste0("Prices_", workdate)), "*COLLAT_INITIAL-CF-Scen100")
- dealnames <- c(dealnames, list.files(file.path(root.dir, "Scenarios", paste0("Prices_", workdate)), "*COLLAT-CF-Scen100"))
- dealnames <- unique(sapply(strsplit(dealnames, "-"), function(x) x[1]))
+ dealnames <- list.files(pricesdir, "*COLLAT_INITIAL-CF-Scen100")
+ dealnames <- c(dealnames, list.files(pricesdir, "*COLLAT-CF-Scen100"))
+ dealnames <- unique(vapply(strsplit(dealnames, "-"), function(x) x[1], character(1)))
cusips <- setdiff(allfiles, dealnames)
dealnames <- tolower(dealnames)
}