vulnerability-indicators
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. It is currently in active development.
Running the targets pipeline in R
Clone the repo. In RStudio, run library(targets)
and tar_make()
. This will require ScienceBase credentials and 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
.