Package 'nesRdata'

Title: National Eutrophication Survey Data
Description: Serves data from the United States Environmental Protection Agency (USEPA) National Eutrophication Survey <https://www.epa.gov/national-aquatic-resource-surveys>.
Authors: Jemma Stachelek [aut, cre]
Maintainer: Jemma Stachelek <[email protected]>
License: GPL
Version: 0.3.1
Built: 2024-11-03 03:05:03 UTC
Source: https://github.com/jsta/nesrdata

Help Index


cache_path

Description

Return path to OS agnostic cache location specified by the rappdirs package

Usage

cache_path()

National Eutrophication Survey Data

Description

A dataset containing hydrologic and water quality data for approximately 800 lakes in the continental United States.

Usage

nes

Format

An object of class data.frame with 775 rows and 39 columns.

Details

variable name description units
pdf pdf identifier (474 - 477) integer
pagenum page number of the pdf (not the report page number) integer
storet_code identifier which links measurement to coordinate locations character
state state where the water body resides character
name name of the water body character
county county where the water body resides character
lake_type natural or impoundment character
drainage_area the total drainage area square kilometers
surface_area the area of the water surface sq km
mean_depth the volume of the water body divided by the surface area in square meters meters
total_inflow the mean of the inflows of all tributaries and the immediate drainage cubic meters per second
retention_time a mean value determined by dividing the lake volume, in cubic meters, by the mean annual outflow in cubic meters per unit of time in years or days
retention_time_units the units of time for each retention entry years or days
alkalinity alkalinity milligrams per liter
conductivity conductivity microohms
secchi secchi meters
tp total phosphorus milligrams per liter
po4 orthophosphate milligrams per liter
tin total inorganic nitrogen milligrams per liter
tn total nitrogen milligrams per liter
p_pnt_source_muni municipal point source phosphorus loading kilograms per year
p_pnt_source_industrial industrial point source phosphorus loading kilograms per year
p_pnt_source_septic septic point source phosphorus loading kilograms per year
p_nonpnt_source nonpoint source phosphorus loading kilograms per year
p_total total phosphorus loading kilograms per year
n_pnt_source_muni municipal point source nitrogen loading kilograms per year
n_pnt_source_industrial industrial point source nitrogen loading kilograms per year
n_pnt_source_septic septic point source nitrogen loading kilograms per year
n_nonpnt_source nonpoint source nitrogen loading kilograms per year
n_total total nitrogen loading kilograms per year
p_total_out total phosphorus outlet load kilograms per year
p_percent_retention percent phosphorus retention percent
p_surface_area_loading phosphorus surface area loading grams per square meter per year
n_total_out total nitrogen outlet load kilograms per year
n_percent_retention percent nitrogen retention percent
n_surface_area_loading nitrogen surface area loading grams per square meter per year
lat latitude decimal degrees
long longitude decimal degrees

Examples

data(nes)
head(nes)

Compile data to R data (rds) object

Description

Compile data from component flat files

Usage

nes_compile(version_id, format = "rds", folder = tempdir(), skip = NA)

Arguments

version_id

character nes version string

format

character choice of "rds" or "sqlite"

folder

file.path to data folder; set to cache_path() to have data persist between sessions.

skip

numeric vector of lines to skip on file read. optional.

Examples

## Not run: 
nes_get("1")
nes_compile("1", format = "rds")

nes_get("1", dest_folder = cache_path(), compile = FALSE)
nes_compile("1", folder = cache_path())

## End(Not run)

nes_get

Description

Retrieves external files and store in file cache.

Usage

nes_get(version_id, dest_folder = tempdir(), skip = NA, compile = TRUE)

Arguments

version_id

character version id

dest_folder

file.path optional will default to the location returned by user_data_dir.

skip

numeric vector of lines to skip on file read. optional.

compile

logical perform on-the-fly compilation to rds?

Examples

## Not run: 
nes_get(version_id = "5") # save to temp folder

nes_get(version_id = "5", dest_folder = cache_path()) # save to cache folder

## End(Not run)

Ingest flat files

Description

Ingest data from component flat files

Usage

nes_ingest(version_id, folder = NA, skip = NA)

Arguments

version_id

character nes version string

folder

file.path to data folder. optional.

skip

numeric vector of lines to skip on file read. optional.

Examples

## Not run: 
nes_ingest("1")

## End(Not run)

nes_load

Description

Load files from local file system

Usage

nes_load(version_id, folder = tempdir(), format = "rds", fpath = NA)

Arguments

version_id

character database version string

folder

file.path to data folder; use cache_path() to load cached (non-temporary) data

format

character choice of rds or sqlite

fpath

file.path optionally specify custom location of rds file

Examples

## Not run: 

# load from tempdir
nes_get("5")
dt  <- nes_load("5")

# load from cached
nes_get("5", dest_folder = cache_path())
dt  <- nes_load("5")

## End(Not run)

nes_ls

Description

nes_ls

Usage

nes_ls(version_id, folder = temp_path(), ...)

Arguments

version_id

character version id

folder

file.path to NES data; pass cache_path() to use OS agnostic cache location specified by the rappdirs package.

...

extra arguments passed to list.files

Examples

nes_ls("1")

nes_versions

Description

nes_versions

Usage

nes_versions()

Examples

nes_versions()