Skip to contents

Create map showing the geographic distribution of patients

Usage

plot_person_map(ds, per_capita = FALSE)

Arguments

ds

A PicnicHealth data set list object.

per_capita

A boolean indicator, defaults to FALSE, which plots raw patient counts. If TRUE, plots the number of patients per 10,000,000 people in each state, rather than the absolute number of patients in each state, using the US Census's July 1, 2022 Annual Estimate of the Resident Population for the United States.

Value

A ggplot of patient visits by state.

Details

Requires the following tables in the PicnicHealth data set list object, ds:

  • visit

  • care_site

Patient states are inferred using the get_patient_state_province() function: patients are assigned to the state in which they had the most visits in the two years preceding their most recent visit. If multiple states or provinces have the same number of visits for a patient, the state/province with the most recent visit is selected.

Uses the plot_usmap() function from the usmap package.

See also

Examples

if (FALSE) { # \dontrun{
ds <- load_data_set("/path/to/data")
plot_person_map(ds)
plot_person_map(ds, per_capita = TRUE)
} # }