diff --git a/README.Rmd b/README.Rmd index e6f2fa7..04802a0 100644 --- a/README.Rmd +++ b/README.Rmd @@ -1,7 +1,5 @@ --- -output: - md_document: - variant: gfm +output: github_document --- @@ -10,7 +8,8 @@ output: knitr::opts_chunk$set( collapse = TRUE, comment = "#>", - fig.path = "man/figures/README-" + fig.path = "man/figures/README-", + fig.retina = 2 ) library(tidyverse) diff --git a/README.md b/README.md index c126a9b..1a24704 100644 --- a/README.md +++ b/README.md @@ -1,23 +1,19 @@ - -# echor + +echor +===== -[![CRAN -status](https://www.r-pkg.org/badges/version/echor)](https://cran.r-project.org/package=echor) +[![CRAN status](https://www.r-pkg.org/badges/version/echor)](https://cran.r-project.org/package=echor) -[![Travis build -status](https://travis-ci.org/mps9506/echor.svg?branch=master)](https://travis-ci.org/mps9506/echor) -[![AppVeyor build -status](https://ci.appveyor.com/api/projects/status/github/mps9506/echor?branch=master&svg=true)](https://ci.appveyor.com/project/mps9506/echor) -[![Coverage -status](https://codecov.io/gh/mps9506/echor/branch/master/graph/badge.svg)](https://codecov.io/github/mps9506/echor?branch=master) +[![Travis build status](https://travis-ci.org/mps9506/echor.svg?branch=master)](https://travis-ci.org/mps9506/echor) [![AppVeyor build status](https://ci.appveyor.com/api/projects/status/github/mps9506/echor?branch=master&svg=true)](https://ci.appveyor.com/project/mps9506/echor) [![Coverage status](https://codecov.io/gh/mps9506/echor/branch/master/graph/badge.svg)](https://codecov.io/github/mps9506/echor?branch=master) -## Overview +Overview +-------- -echor downloads wastewater discharge and air emission data for EPA -permitted facilities using the [EPA ECHO API](https://echo.epa.gov/). +echor downloads wastewater discharge and air emission data for EPA permitted facilities using the [EPA ECHO API](https://echo.epa.gov/). -## Installation +Installation +------------ echor is on CRAN: @@ -32,21 +28,19 @@ Or install the development version from github: devtools::install_github("mps9506/echor") ``` -## Usage +Usage +----- -[Getting -started](https://mps9506.github.io/echor/articles/introduction.html) +[Getting started](https://mps9506.github.io/echor/articles/introduction.html) [Functions](https://mps9506.github.io/echor/reference/index.html) -## Examples +Examples +-------- ### Download information about facilities with an NPDES permit -We can look up plants by permit id, bounding box, and numerous other -parameters. I plan on providing documentation of available parameters. -However, arguments can be looked up here: -[get\_cwa\_rest\_services\_get\_facility\_info](https://echo.epa.gov/tools/web-services/facility-search-water#!/Facility_Information/get_cwa_rest_services_get_facility_info) +We can look up plants by permit id, bounding box, and numerous other parameters. I plan on providing documentation of available parameters. However, arguments can be looked up here: [get\_cwa\_rest\_services\_get\_facility\_info](https://echo.epa.gov/tools/web-services/facility-search-water#!/Facility_Information/get_cwa_rest_services_get_facility_info) ``` r library(tidyverse) @@ -81,14 +75,7 @@ head(df) #> # CWPStateWaterBodyCode ``` -The ECHO database can provide over 270 different columns. echor returns -a subset of these columns that should work for most users. However, you -can specify what data you want returned. Use `echoWaterGetMeta()` to -return a dataframe with column numbers, names, and descriptions to -identify the columns you want returned. Then include the column numbers -as a comma seperated string in the `qcolumns` argument. In the example -below, the `qcolumns` argument indicates the dataframe will include -plant name, 8-digit HUC, latitute, longitude, and total design flow. +The ECHO database can provide over 270 different columns. echor returns a subset of these columns that should work for most users. However, you can specify what data you want returned. Use `echoWaterGetMeta()` to return a dataframe with column numbers, names, and descriptions to identify the columns you want returned. Then include the column numbers as a comma seperated string in the `qcolumns` argument. In the example below, the `qcolumns` argument indicates the dataframe will include plant name, 8-digit HUC, latitute, longitude, and total design flow. ``` r df <- echoWaterGetFacilityInfo(output = "df", @@ -109,8 +96,7 @@ head(df) #> 6 HOLLEMAN EXTEN~ TXR10F4~ 12070103 30.6 -96.3 NA ``` -When returned as sf dataframes, the data is suitable for immediate -spatial plotting or analysis: +When returned as sf dataframes, the data is suitable for immediate spatial plotting or analysis: ``` r library(ggmap) @@ -154,13 +140,11 @@ ggmap(collegestation) + caption = "Source: EPA ECHO database") ``` -![](man/figures/README-example3-1.png) + ### Download discharge/emissions data -Use `echoGetEffluent()` or `echoGetCAAPR()` to download tidy dataframes -of permitted water discharger Discharge Monitoring Report (DMR) or -permitted emitters Clean Air Act annual emissions reports. +Use `echoGetEffluent()` or `echoGetCAAPR()` to download tidy dataframes of permitted water discharger Discharge Monitoring Report (DMR) or permitted emitters Clean Air Act annual emissions reports. ``` r df <- echoGetEffluent(p_id = 'tx0119407', parameter_code = '00300') @@ -178,15 +162,16 @@ ggplot(df) + caption = "Source: EPA ECHO") ``` -![](man/figures/README-unnamed-chunk-2-1.png) + -## Test Results +Test Results +------------ ``` r library(echor) date() -#> [1] "Fri Aug 03 16:46:28 2018" +#> [1] "Sun Aug 05 00:53:09 2018" devtools::test() #> v | OK F W S | Context @@ -202,68 +187,29 @@ devtools::test() / | 8 | core functions return expected errors - | 9 | core functions return expected errors \ | 10 | core functions return expected errors -v | 10 | core functions return expected errors +v | 10 | core functions return expected errors [1.4 s] #> / | 0 | core functions return expected objects -- | 0 1 | core functions return expected objects -\ | 0 2 | core functions return expected objects -| | 1 2 | core functions return expected objects -/ | 2 2 | core functions return expected objects -- | 2 1 2 | core functions return expected objects[1] "# Status message: Success" -#> [2] "# Status message: OK" -#> [3] "# Status message: Success: (200) OK" -#> -\ | 2 1 3 | core functions return expected objectsCannot open data source C:\Users\michael.schramm\AppData\Local\Temp\Rtmpa4wMKJ\spoutput27187fb65e8f.geojson -#> -| | 2 2 3 | core functions return expected objects -x | 2 2 3 | core functions return expected objects [1.7 s] -#> ----------------------------------------------------------------------------------------------------- -#> test-expected_objects.R:7: warning: core functions return tbl_df -#> number of columns of result is not a multiple of vector length (arg 2) -#> -#> test-expected_objects.R:7: warning: core functions return tbl_df -#> 1 parsing failure. -#> row # A tibble: 1 x 5 col row col expected actual file expected actual 1 2 1 columns 2 columns file # A tibble: 1 x 5 -#> -#> -#> test-expected_objects.R:13: error: core functions return tbl_df -#> object 'Year1' not found -#> 1: echoGetCAAPR(p_id = "110000350174") at C:\BACKUP\Documents\Data-Analysis-Projects\echor/tests/testthat/test-expected_objects.R:13 -#> 2: tidyr::gather_(pollutant, "Year", "Discharge", c("Year1", "Year2", "Year3", "Year4", "Year5", "Year6", -#> "Year7", "Year8", "Year9", "Year10")) at C:\BACKUP\Documents\Data-Analysis-Projects\echor/R/air.R:246 -#> 3: gather_.data.frame(pollutant, "Year", "Discharge", c("Year1", "Year2", "Year3", "Year4", "Year5", "Year6", -#> "Year7", "Year8", "Year9", "Year10")) -#> 4: gather(data, key = !!key_col, value = !!value_col, !!!gather_cols, na.rm = na.rm, convert = convert, factor_key = factor_key) -#> 5: gather.data.frame(data, key = !!key_col, value = !!value_col, !!!gather_cols, na.rm = na.rm, convert = convert, -#> factor_key = factor_key) -#> 6: unname(tidyselect::vars_select(names(data), !!!quos)) -#> 7: tidyselect::vars_select(names(data), !!!quos) -#> 8: vars_select_eval(.vars, quos) -#> 9: map_if(quos, !is_helper, overscope_eval_next, overscope = overscope) -#> 10: map(.x[sel], .f, ...) -#> 11: .f(.x[[i]], ...) -#> -#> test-expected_objects.R:51: warning: core functions return sf -#> GDAL Error 4: Failed to read GeoJSON data -#> -#> test-expected_objects.R:51: error: core functions return sf -#> Open failed. -#> 1: echoAirGetFacilityInfo(p_pid = "NC0000003706500036", output = "sf", verbose = FALSE) at C:\BACKUP\Documents\Data-Analysis-Projects\echor/tests/testthat/test-expected_objects.R:51 -#> 2: convertSF(buildOutput) at C:\BACKUP\Documents\Data-Analysis-Projects\echor/R/air.R:122 -#> 3: sf::read_sf(t) at C:\BACKUP\Documents\Data-Analysis-Projects\echor/R/utils.R:138 -#> 4: st_as_sf(tibble::as_tibble(as.data.frame(st_read(..., quiet = quiet, stringsAsFactors = stringsAsFactors)))) -#> 5: tibble::as_tibble(as.data.frame(st_read(..., quiet = quiet, stringsAsFactors = stringsAsFactors))) -#> 6: as.data.frame(st_read(..., quiet = quiet, stringsAsFactors = stringsAsFactors)) -#> 7: st_read(..., quiet = quiet, stringsAsFactors = stringsAsFactors) -#> 8: st_read.default(..., quiet = quiet, stringsAsFactors = stringsAsFactors) -#> 9: CPL_read_ogr(dsn, layer, as.character(options), quiet, type, promote_to_multi, int64_as_string) -#> ----------------------------------------------------------------------------------------------------- +- | 1 | core functions return expected objects +\ | 2 | core functions return expected objects +| | 3 | core functions return expected objects +/ | 4 | core functions return expected objects +- | 5 | core functions return expected objects +\ | 6 | core functions return expected objects +| | 7 | core functions return expected objects +/ | 8 | core functions return expected objects +- | 9 | core functions return expected objects +\ | 10 | core functions return expected objects +| | 11 | core functions return expected objects +/ | 12 | core functions return expected objects +- | 13 | core functions return expected objects +v | 13 | core functions return expected objects [9.5 s] #> -#> == Results ========================================================================================== -#> Duration: 1.8 s +#> == Results ================================================================================================= +#> Duration: 10.9 s #> -#> OK: 12 -#> Failed: 2 -#> Warnings: 3 +#> OK: 23 +#> Failed: 0 +#> Warnings: 0 #> Skipped: 0 ``` diff --git a/man/figures/README-example3-1.png b/man/figures/README-example3-1.png index fcff0a5..5fd7791 100644 Binary files a/man/figures/README-example3-1.png and b/man/figures/README-example3-1.png differ diff --git a/man/figures/README-unnamed-chunk-2-1.png b/man/figures/README-unnamed-chunk-2-1.png index baed16c..5636a8f 100644 Binary files a/man/figures/README-unnamed-chunk-2-1.png and b/man/figures/README-unnamed-chunk-2-1.png differ