R/freadRDS.R

Defines functions freadRDS

Documented in freadRDS

#' Function to Load an RDS file containing past simulation results
#' 
#' This function attempts to load a rds file and check it contains a list with elemets
#' info and estMdl. Uses readRDS
#' 
#' @param filePath Full path to the csv file
#' 
#' @keywords FloorForT
#' @export
#' @examples
#' # Not Run
#' # ModelBuild()
freadRDS <- function(filePath){
  tmp <- readRDS(filePath)
  nms <- c("mdlTbl","mdl","baseData","mdlData","varTbl")

  if(!all(nms %in% names(tmp))){
      stop('RDS file does not contain a past analysis')
  }
  return(tmp)
}
waternumbers/FloodForT documentation built on Nov. 5, 2019, 12:07 p.m.