distance_exposure: Write storm distance exposure files

Description Usage Arguments Value Examples

View source: R/distance_exposure.R

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) and creates a dataframe with storm listings and dates that can be merged with time series of health or other outcomes, giving the dates and exposures for all storms meeting the given storm distance criteria.

Usage

1
2
distance_exposure(locations, start_year, end_year, dist_limit, 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 (commun) and associated FIPS codes (fips), for multi-county community output. See the examples for the proper format for this argument.

start_year

Four-digit integer with first year to consider.

end_year

Four-digit integer with last year to consider.

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.

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 "csv" (default) and "rds".

Value

Writes out a directory with rain exposure files for each county or community indicated. For more on the columns in this output, see the documentation for county_rain and multi_county_rain.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
## 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 to work, you will need to have a directory called "tmp"
# as a subdirectory of your home directory. These examples will create new
# directories with exposure output to that "tmp" directory.

# By county
distance_exposure(locations = c("22071", "51700"),
              start_year = 1995, end_year = 2005,
              dist_limit = 75,
              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"))
distance_exposure(locations = communities,
              start_year = 1995, end_year = 2005,
              dist_limit = 75,
              out_dir = "~/tmp/storms")
}

## End(Not run)

geanders/hurricaneexposure documentation built on May 17, 2019, 12:14 a.m.