Unequal access to water: how societal factors shape vulnerability to water insecurity
This repo uses R, Vue, and D3 to build an interactive data visualization website about indicators of vulnerability to water insecurity. In R there is a pipeline that uses the targets
library to fetch, process, and visualize data. The rest of the files build the website.
This project:
-
Pulls, processes, and visualizes data from the USGS Uncertainty Summary of Water Vulnerability in the Western US 2000-2022.
-
Pull, processes, and visualizes data from the U.S. Census Bureau using the R package [
tidycensus
](https://walker-data.com/tidycensus/. -
Builds a javascript website using data visualization to communicate the motivation for the USGS Social and Economic Drivers project, highlighting how societal factors shape exposure to water-related hazards across the Western U.S.. The website can be accessed here
Running the targets pipeline in R
Clone the repo. In RStudio, run library(targets)
and tar_make()
. This will require tidycensus
credentialing to run, see instructions below.
tidycensus
set up
Adapted from package developers Kyle Walker & Matt Herman, to set up tidycensus
run the following in the R Console:
# install.packages("tidycensus")
library(tidycensus)
library(tidyverse)
You will also need to set a Census API key. A key can be obtained from http://api.census.gov/data/key_signup.html.
census_api_key("YOUR API KEY GOES HERE", install = TRUE)
readRenviron("~/.Renviron")
Building the website locally
Clone the repo. In the directory, run npm install
to install the required modules. Once the dependencies have been installed, run npm run dev
to run locally from your browser.
To build the website locally you'll need npm v20
and node v8.1
or higher installed. To manage multiple versions of npm
, you may try using nvm
.
Disclaimer
This software has been approved for release by the U.S. Geological Survey (USGS). Although the software has been subjected to rigorous review, the USGS reserves the right to update the software as needed pursuant to further analysis and review. No warranty, expressed or implied, is made by the USGS or the U.S. Government as to the functionality of the software and related material nor shall the fact of release constitute any such warranty. Furthermore, the software is released on condition that neither the USGS nor the U.S. Government shall be held liable for any damages resulting from its authorized or unauthorized use.
Citation
Azadpour E, Carr AN, Clarke A, Drakes O, Restrepo-Osorio DL, Nell C. 2024. Unequal access to water: How societal factors shape vulnerability to water insecurity. U.S. Geological Survey software release. Reston, VA. https://doi.org/10.5066/P19M9WYT.