knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%", warning = FALSE ) devtools::load_all() library(ggplot2) library(dplyr)
The goal of tidyVA is to provide simple features of Veterans Health Administration geographies. Data included are tidy data frames of VHA spatial data obtained from data.va.gov. Please note the site is no longer operational while VA establishes a new open data portal.
The benefit of simple features in R is that they allow for tidy spatial analysis.
You can install tidyVA from GitHub with:
remotes::install_github("iecastro/tidyVA")
The following included datasets are sf-tibbles of VHA geographies with a common CRS - EPSG: 4326.
Summarized descriptions from data.va.gov
county
: The county layer is the base geographic unit of the VISN-Market-Submarket-Sector-County hierarchy.
sector
: A sector is a cluster of geographically adjacent counties within a VA Submarket.
submarket
: Submarkets reflect a clustering of the enrolled population within a market and are an aggregation of Sectors.
market
: Each market is built from submarkets and represent an aggregated geographic area having sufficient population and geographic size to benefit from planning healthcare services. Markets cross state borders where necessary to keep the catchment area within the same market
visn
: VISNs are the upper echelon in the VHA hierarchy. VISN boundaries align with those of their constituent markets and can span across non-contiguous areas.
states
: Simple features of states and territories of the US (CRS - EPSG: 4326). Used for spatial joins and geometric manipulations.
VAloc
: Simple features (CRS - EPSG: 4326) of all VA facilities - from all Administrations: Veterans Health Administration, Veterans Benefits Administration, and National Cemetery Administration
This is a basic example which shows you how to solve a common problem:
VHA Submarkets are an aggregation of Sectors; and Sectors are comprised of one or more counties. Since each VISN is defined in a hierarchy, this dataset contains attributes of all echelons above submarket - that is, Market and VISN.
library(ggplot2) library(dplyr) library(tidyVA) data("submarket")
ggplot() + geom_sf(data = submarket, fill = NA)
knitr::include_graphics("man/figures/README-example-1.png")
Although accurate, this output is not very easy to work with. Since this is in tidy format, though, we can easily filter and manipulate the data.
glimpse(submarket)
visn2 <- submarket %>% filter(VISN == "02") visn2
submarket %>% filter(VISN == "02")
ggplot() + geom_sf(data = visn2, aes(fill = MARKET), color = NA) + geom_sf(data = visn2, fill = NA, color = "#ffffff", size = .25)
knitr::include_graphics("man/figures/README-unnamed-chunk-4-1.png")
shift_geo
shift_geo()
will project and re-position Alaska and Hawaii, When supplied a complete dataset (from VHA Geographies).
shift_geo(submarket) %>% ggplot() + geom_sf(fill = NA) + theme_minimal()
knitr::include_graphics("man/figures/README-unnamed-chunk-5-1.png")
theme_va()
theme_va()
is a copy of theme_ipsum
from hrbrthemes. It's a ggplot theme with some color and plotting modifications to the defaults.
data("visn") visn %>% ggplot(aes(reorder(VISN,Shape_Area), Shape_Area)) + geom_col() + labs(x = "VISN", y = "Shape Area", caption = "Caption here") + ggtitle("Shape Area of VA Service Networks", subtitle = "This is an example plot") + theme_va(grid = "Y")
knitr::include_graphics("man/figures/README-plot4-1.png")
sail_tidy
sail_tidy
will return a tibble of VA SAIL metrics when provided a data table url.
sail_tidy("https://www.va.gov/QUALITYOFCARE/SAIL_FY19_Q1/SAIL-5_clarksburg_fy19q1.xlsx")
Development of this package partly supported by a research grant from the National Institute on Alcohol Abuse and Alcoholism - NIH Grant #R34AA026745-01.
This product is not endorsed nor certified by either VA or NIH/NIAAA.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.