Main content

Home

Menu

Loading wiki pages...

View
Wiki Version:
**Code and data for Walsh et al. (2021). Linking stormwater control performance to stream ecosystem outcomes: incorporating a performance metric into effective imperviousness.** The code and data in this repository can most easily be used by creating a fork to the linked github repository https://github.com/cjbwalsh/lsc_dbs_scms. The large data files stored in the OSF repository are downloaded to the local version of the forked github repository when the script load_ld_scms_tables.R is run. (This file is sourced, and the data downloaded, if you run or knit most of the Rmd files.) The RMarkdown documents with names like walsh_etal_foundation_PLOSW_S1.Rmd are the source code of the supplementary materials (S1-S5) of the paper, and walsh_etal_foundation_PLOSW_figs_tab.Rmd is the source of the paper's figures and table. The data were originally stored as a postgreSQL database, with this structure. ![Tables in repository structured as a postgreSQL database][1] [1]: https://raw.githubusercontent.com/cjbwalsh/lsc_dbs_scms/master/images/ld_scms_ER_diagram.png?token=AEGJPVJWZT3XZPUFUA6AHLLA43VLK All spatial tables are stored as gpkg files, and non-spatial tables are saved in the R data file data/db_non_sf.rda. Field definitions for all tables are listed in the metadata table. The structure of the database is described in detail in S3 appendix. The script compile_ld_scms_db_from_tables.R provides guidance on reconstructing the postgreSQL database locally. project_EBs.R calculates performance metrics for all stormwater control measures in the project and was used to compile data/scmProjects_EB.rda. references.bib, plos.csl, and officedown_template.docx are used in knitting the Rmd documents. The R scripts require the following packages to be installed: "scales", "dplyr", "lubridate", "sf", "here", "RPostgreSQL", "mcr", "RColorBrewer", "data.table", "RMySQL", "DiagrammeR", "flextable", and "rstan".