View source: R/location_functions.R
| tract_distance_matrix | R Documentation |
Creates an all-pairs distance matrix between census tract centroids for a
state, using state abbreviation input similar to
zip_distance_matrix().
tract_distance_matrix(
st,
county = NULL,
unit = c("miles", "kilometers", "meters"),
use_cache = TRUE,
...
)
st |
Character scalar; 2-character USPS state abbreviation
(for example, |
county |
A three-digit FIPS code (string) of the county or counties to subset on. This can also be a county name or vector of names. |
unit |
Character string; one of |
use_cache |
Logical; if |
... |
arguments passed on to tigris::tracts |
A list with:
Character vector of tract GEOIDs (same order as matrix dimensions)
Square numeric matrix of pairwise distances in requested units
md_dm <- tract_distance_matrix("MD")
dim(md_dm$distance_matrix)
md_dm_km <- tract_distance_matrix("MD", unit = "kilometers")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.