aboutsummaryrefslogtreecommitdiffstats
path: root/R/load_cf.R
diff options
context:
space:
mode:
Diffstat (limited to 'R/load_cf.R')
-rw-r--r--R/load_cf.R8
1 files changed, 3 insertions, 5 deletions
diff --git a/R/load_cf.R b/R/load_cf.R
index 07b1a960..ff9a8d6b 100644
--- a/R/load_cf.R
+++ b/R/load_cf.R
@@ -34,10 +34,8 @@ setEvaluationDate(as.Date(MarkitData$effectiveasof))
sanitize.column <- function(vec){
vec <- gsub(",", "", vec)
index <- grep("\\(", vec)
- for(l in index){
- vec[l] <- -as.numeric(substr(vec[l], 2, nchar(vec[l])-1))
- }
- return( as.numeric(vec) )
+ vec[index] <- unlist(lapply(index, function(l)-as.numeric(substr(vec[l], 2, nchar(vec[l])-1))))
+ return(as.numeric(vec))
}
if(length(args)>=2){
@@ -74,7 +72,7 @@ getdealcf <- function(dealnames, workdate=Sys.Date()){
if(is.na(sqldata$"Reinv End Date")){
tranches <- "COLLAT"
}else{
- tranches <- c("COLLAT_REINVEST", "COLLAT_INITIAL")
+ tranches <- c("COLLAT_INITIAL", "COLLAT_REINVEST")
}
for(tranche in tranches){
for(i in 1:n.scenarios){