R/readStorm.R

#' Read storm data.
#'
#' Read storm data for one city based on exposure criterion. The storm data was
#' generated by "Hurricaneexposure" package and located in the subdirectory
#' "exposure".
#'
#' @inheritParams readCity
#'
#' @param criterion A character string which could be "rain50", "wind18", etc.
#'
#' @return This function returns a dataframe containing information of all
#' storms in the city between 1988 to 2005. Variables might be different
#' depending on the exposure crtierion.
#'
#' @examples
#' \dontrun{readStorm(criterion = "rain75", city = "miam")}
#'
#' @export
readStorm <- function(criterion = c(), city = c()){
        root <- "exposure/"
        file <- paste(root, criterion, "/", city, ".rds", sep = "")
        df <- readRDS(file)
        df <- as.data.frame(df)
        df$date <- lubridate::ymd(df$closest_date)
    return(df)
}
my1120/Hurricane documentation built on May 23, 2019, 11:58 a.m.