Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
mps9506 committed Aug 5, 2018
1 parent 0d0980d commit 5259fb5
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 102 deletions.
7 changes: 3 additions & 4 deletions README.Rmd
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
---
output:
md_document:
variant: gfm
output: github_document
---

<!-- README.md is generated from README.Rmd. Please edit that file -->
Expand All @@ -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)
Expand Down
142 changes: 44 additions & 98 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
<!-- README.md is generated from README.Rmd. Please edit that file -->

# echor
<!-- README.md is generated from README.Rmd. Please edit that file -->
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:

Expand All @@ -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)
Expand Down Expand Up @@ -81,14 +75,7 @@ head(df)
#> # CWPStateWaterBodyCode <chr>
```

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",
Expand All @@ -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)
Expand Down Expand Up @@ -154,13 +140,11 @@ ggmap(collegestation) +
caption = "Source: EPA ECHO database")
```

![](man/figures/README-example3-1.png)<!-- -->
<img src="man/figures/README-example3-1.png" width="672" />

### 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')
Expand All @@ -178,15 +162,16 @@ ggplot(df) +
caption = "Source: EPA ECHO")
```

![](man/figures/README-unnamed-chunk-2-1.png)<!-- -->
<img src="man/figures/README-unnamed-chunk-2-1.png" width="672" />

## 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
Expand All @@ -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 <int> <chr> <chr> <chr> <chr> actual 1 2 <NA> 1 columns 2 columns <raw vector> 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
```
Binary file modified man/figures/README-example3-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/README-unnamed-chunk-2-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 5259fb5

Please sign in to comment.