diff options
| -rw-r--r-- | R/load_cf.R | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/R/load_cf.R b/R/load_cf.R index 6165540c..a3525da9 100644 --- a/R/load_cf.R +++ b/R/load_cf.R @@ -115,7 +115,7 @@ getdealcf <- function(dealnames, zipfiles, tradedate=Sys.Date()){ ct <- list(col_date("%b %d, %Y"),
col_character(),
col_character(),
- col_numeric(), col_skip(), col_skip(),
+ col_number(), col_skip(), col_skip(),
col_skip(), col_skip(), col_skip(),
col_skip(), col_skip(), col_skip())
for(tranche in tranches){
@@ -125,13 +125,14 @@ getdealcf <- function(dealnames, zipfiles, tradedate=Sys.Date()){ filename <- paste0(paste(toupper(dealname), tranche, "CF",
paste0("Scen", i), sep="-"), ".txt")
conn <- unz(zip, filename)
- data <- tryCatch(read_tsv(conn, col_types= ct),
- warning=function(w){
- logwarn(conditionMessage(w))
- NULL},
+ data <- tryCatch(suppressWarnings(read_tsv(conn, col_types= ct)),
error=function(e){
logerror(conditionMessage(e))
NULL})
+ ## browser()
+ ## if (!grepl("Missing column names filled in", warnings())) {
+ ## data <- NULL
+ ## }
if(is.null(data)||nrow(data)<1){
loginfo(paste(dealname, i, tranche))
break
@@ -232,17 +233,15 @@ getcusipcf <- function(params, cfdata, dist, tradedate=Sys.Date()){ colnames(r) <- fields
indicdata <- getcusip_indicdata(cusip, dealname, tradedate)
flag <- TRUE
+ ct <- list(col_date("%b %d, %Y"),
+ col_number(),
+ col_number(),
+ col_number(), col_number(), col_number(),
+ col_skip(), col_skip())
for(j in 1:n.scenarios){
filename <- sprintf("%s-CF-Scen%s.txt", cusip, j)
conn <- unz(zip, filename)
- data <- tryCatch(read_tsv(conn, col_types=list(col_date("%b %d, %Y"),
- col_numeric(),
- col_numeric(),
- col_numeric(), col_numeric(), col_numeric(),
- col_skip(), col_skip())),
- warning=function(w){
- logwarn(conditionMessage(w))
- NULL},
+ data <- tryCatch(suppressWarnings(read_tsv(conn, col_types=ct)),
error=function(e){
logerror(conditionMessage(e))
NULL})
|
