aboutsummaryrefslogtreecommitdiffstats
path: root/R/creditIndex.R
diff options
context:
space:
mode:
Diffstat (limited to 'R/creditIndex.R')
-rw-r--r--R/creditIndex.R10
1 files changed, 8 insertions, 2 deletions
diff --git a/R/creditIndex.R b/R/creditIndex.R
index 6ac58375..7b49aa76 100644
--- a/R/creditIndex.R
+++ b/R/creditIndex.R
@@ -54,8 +54,14 @@ print.creditIndex <- function(index){
load.index <- function(name, tenor, date){
## load a creditIndex which was previously saved
- load(file.path(root.dir, "Tranche_data", "Objects",
- paste0(paste(name, tenor, date, sep="_"),".RData")))
+ indexfile <- file.path(root.dir, "Tranche_data", "Objects",
+ paste0(paste(name, tenor, date, sep="_"),".RData"))
+ if(file.exists(indexfile)){
+ load(indexfile)
+ }else{
+ loginfo(paste(name, tenor, "file missing"))
+ return(NULL)
+ }
return(index)
}