rain_exposure {hurricaneexposure} | R Documentation |
Write storm rain exposure files
Description
This function takes an input of locations (either a vector of county FIPS or a dataframe of multi-county FIPS, with all FIPS listed for each county; see examples) and creates time series dataframes with the dates and exposures for all storms meeting the given rainfall and storm distance criteria. These exposure time series can then be merged with other time series (e.g., community-specific daily counts of health outcomes).
Usage
rain_exposure(
locations,
start_year,
end_year,
rain_limit,
dist_limit,
days_included = c(-2, -1, 0, 1),
out_dir,
out_type = "csv"
)
Arguments
locations |
Either a vector of FIPS county codes, for county-level
output, or a dataframe with columns for community identifier ( |
start_year |
Four-digit integer with first year to consider. |
end_year |
Four-digit integer with last year to consider. |
rain_limit |
Minimum of rainfall, in millimeters, summed across the days
selected to be included ( |
dist_limit |
Maximum distance, in kilometers, of how close the storm track must come to the county's population mean center to classify the county as "exposed" to the storm. |
days_included |
A numeric vector listing the days to include when
calculating total precipitation. Negative numbers are days before the
closest date of the storm to a county. For example,
|
out_dir |
Character string giving the pathname of the directory in which to write output. This directory should already exist on your computer. |
out_type |
Character string giving the type of output files you'd like.
Options are |
Value
This function writes out rain exposure files for each county or
community indicated to the specified output directory (out_dir
).
For more details on the columns in the output files, see the
documentation for county_rain
and
multi_county_rain
.
Examples
## Not run:
# Ensure that data package is available before running the example.
# If it is not, see the `hurricaneexposure` package vignette for details
# on installing the required data package.
if (requireNamespace("hurricaneexposuredata", quietly = TRUE)) {
# For these examples, you need to have a directory in your home
# directory called "tmp".
# By county
rain_exposure(locations = c("22071", "51700"),
start_year = 1995, end_year = 2005,
rain_limit = 100, dist_limit = 100,
out_dir = "~/tmp/storms")
# For multi-county communities
communities <- data.frame(community_name = c(rep("ny", 6), "no", "new"),
fips = c("36005", "36047", "36061",
"36085", "36081", "36119",
"22071", "51700"))
rain_exposure(locations = communities,
start_year = 1995, end_year = 2005,
rain_limit = 100, dist_limit = 100,
out_dir = "~/tmp/storms")
}
## End(Not run)