main.R

library(devtools)
library(testthat)

# required packages
use_package("dplyr")
use_package("httr")
use_package("assertthat")

# tests
use_testthat()

# document
document()

# install
devtools::install()

# vignettes
devtools::use_vignette("envirofacts")

# data

allapis <- jsonlite::fromJSON("http://theapistack.com/data/environmental-protection-agency/apis.json")
serviceURLs <- vapply(allapis$apis$properties, function(lst) lst$url[1], character(1))[-1] # don't include first one, generic envirofacts url
serviceNames <- stringr::str_extract(serviceURLs, "[[:lower:]]+(?=/model)")
serviceNames[c(3, 8)] <- c("cerclis", "pcs-icis")
descs <- allapis$apis$description[-1]

services <- setNames(descs, serviceNames)
use_data(services)

sdwisCodes <- read.csv("inst/codes/SDWISCodes_analyteLookup.csv",
                       stringsAsFactors = FALSE)
use_data(sdwisCodes, internal = TRUE, overwrite = TRUE)
markwh/envirofacts documentation built on May 21, 2019, 12:26 p.m.