项目作者: tiernanmartin

项目描述 :
An assessment of displacement risk
高级语言: HTML
项目地址: git://github.com/tiernanmartin/COO-Displacement-Risk.git
创建时间: 2016-09-17T18:37:14Z
项目社区:https://github.com/tiernanmartin/COO-Displacement-Risk

开源协议:

下载


Project Description

Tiernan Martin, Futurewise
| Last updated: 01 February, 2017

Usage Notes

Rendering a Gitbook

This repository contains the data, scripts, and outputs for the Displacement Risk Assessment project. The directory is structured in the following folder hierarchy:

  1. .
  2. ├── 1-data
  3. ├── 1-notebooks
  4. └── html_support_files
  5. ├── 2-raw
  6. ├── 3-external
  7. └── manual
  8. ├── 4-interim
  9. └── archive
  10. └── tmp
  11. └── 5-tidy
  12. ├── 2-analysis
  13. ├── 3-communication
  14. ├── 1-bookdown <- contains the bookdown document render script
  15. ├── _book
  16. ├── css
  17. ├── images
  18. └── latex
  19. ├── 2-shinyapps
  20. └── others
  21. ├── html
  22. ├── images
  23. ├── msword
  24. ├── pdf
  25. └── sp
  26. ├── javascripts
  27. ├── packrat
  28. ├── proj-setup-scripts
  29. ├── stylesheets
  30. └── vault

Because the bookdown folders are located below the repo’s root directory, it is necessary to use a custom R script to render the User Guide document. To run this script, perform the following commands in a shell):

  1. Move into the repo’s local directory (e.g., cd ~/Downloads/COO-Displacement-Risk)
  2. Move into the _book directory: cd ./3-communication/1-bookdown/
  3. Run the rendering script: Rscript _render.R 'bookdown::gitbook'

    • Note: if this script fails and returns an error saying C stack usage is too close to the limit, then the limit must be manually adjusted by running the following shell command: $ ulimit -s 16384. For more details see here.
  4. To view the result, open the following HTML file in a browser: ./3-communication/1-bookdown/_book/index.html

Working with a clone of the repo

In an effort to make this project as easy to reproduce as possible, the project uses only free and open-source software, is thoroughly documented, and is published on Github. However, there are several things to consider when working with a clone of this repo:

Downloading Datasets Too Large for Github

Due to Github’s file size limitations, some of the raw datasets are not included in the repo. Running the package for the first time on a local clone will trigger the download of these large files, which will be a time-consuming operation (perhaps prohibitively slow, depending on the user’s internet connection speed). It is recommended that users step through each of the rmarkdown files (*.Rmd) in 1-data/1-notebooks/, running each code chunk and allowing the downloads to take place as necessary.

While this process is acceptably quick for most of the notebooks, there are a few that contain operations that may take anywhere from 30 minutes to an hour to run. These processes involve external geospatial datasets that are very large (e.g. 2GB) and are not available online (this may change eventually, but for now they must be obtained by contacting King County’s GIS Department). If a user needs to reproduce this assessment “from scratch”, they should contact the repo maintainer: tiernan[at]futurewise[dot]org

Using the acs R Package

Several of the datasets used in this project were collected using an R package named acs. This package accesses data collected by the American Community Survey using the Census Data API, which requires its users to obtain a key before using. Any users interested in reproducing these datasets must obtain their own personal API key (http://api.census.gov/data/key_signup.html) and install it using the acs::api.key.install command. Several of the acs functions will not work until this key is installed.