View source: R/location_functions.R
| create_custom_dist_list | R Documentation |
This function is a custom-data version of create_dist_list(). It
returns a list of named numeric vectors where each list element contains only
locations within threshold distance units of a target location.
create_custom_dist_list(
df,
label_var,
lat_var,
long_var,
threshold,
unit = c("miles", "kilometers", "meters")
)
df |
data.frame containing label and coordinate columns |
label_var |
character scalar; column name used as location label (must be unique and non-missing) |
lat_var |
character scalar; latitude column name. |
long_var |
character scalar; longitude column name. |
threshold |
numeric scalar distance cutoff in units of |
unit |
string, one of "miles" (default), "kilometers", or "meters" |
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.
md <- tract_generator("MD")
dlist <- create_custom_dist_list(
df = md,
label_var = "geoid",
lat_var = "latitude",
long_var = "longitude",
threshold = 15,
unit = "miles"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.