create_dist_list: Generalized distance list as sparse list
Description
This function is an alternative to the package functions that create a square
distance matrix of dimension N, with all pairwise distances. In this approach
a list of named vectors is returned, where there is one element in the list
for each location, and each named vector holds the distance within
`threshold` of the location.
Usage
create_dist_list(
level,
threshold,
st = NULL,
county = NULL,
unit = c("miles", "kilometers", "meters")
)
Value
a named list, where each element, named by a target location, is a
named vector of distances that are within `threshold` `units` of the
target.
Arguments
level
string either "county", "zip", or "tract"
threshold
numeric value; include in each location-specific named
vector only those locations that a within `threshold` distance units of the
target. Reasonable thresholds might be 50 (miles), 15 (miles) and 3 (miles)
for county, zip, and tract, respectively, but these can be adjusted. Note
if a different unit other than miles is used, then the user should also
adjust this parameter appropriately
st
string; optional to specify a state; if NULL distances are returned
for all zip codes or counties in the US
county
string vector of 3-fips to restrict within st; ignored
unless level is "tract"
unit
string one of miles (default), kilometers, or meters; this is the
unit relevant to the threshold