Skip to contents

This function retrieves census tract information for a specified state and maps it using H3 hexagons at a given resolution.

Usage

get_census_tract_info_and_map_by_state(state_abbreviation, h3_resolution)

Arguments

state_abbreviation

A two-letter state abbreviation, e.g., 'TX'.

h3_resolution

The resolution of the H3 hexagons to use. Must be an integer between 0 and 15, e.g., 5.

Value

A list containing:

sf_data

The spatial data (sf object) for the census tracts.

p1

A ggplot object showing the census tracts with H3 hexagons.

centroid_plot

A ggplot object showing the centroids of the census tracts.

centroid_hex_assignments

A data frame mapping centroids to H3 hexagons.

tract_centroids_with_hexongs

A combined sf object of centroids and their corresponding H3 hexagons.

shape_centroids

The centroids of the census tracts as an sf object.

Examples

if (FALSE) { # \dontrun{
tx_5 <- get_census_tract_info_and_map_by_state(
  state_abbreviation = 'TX',
  h3_resolution = 5
)
} # }