state_distance_matrix: Get distance matrix for states in the US

View source: R/location_functions.R

state_distance_matrixR Documentation

Get distance matrix for states in the US

Description

Function returns a list of states and a matrix with the distance between those states. leverages a built in dataset ('states')

Usage

state_distance_matrix(unit = c("miles", "kilometers", "meters"))

Arguments

unit

string, one of "miles" (default), "kilometers", or "meters". Indicating the desired unit for the distances

Value

a named list of length two; first element ('loc_vec') is a vector of locations and the second element ('distance_matrix') is a square matrix containing the pairwise distance (in the given 'unit') between all locations.

Examples

state_distance_matrix()
state_distance_matrix(unit = "kilometers")

gsClusterDetect documentation built on July 27, 2026, 5:09 p.m.