akq_rm: Remove or Extract Site Numbers from Copied Package...

Description Usage Arguments Value Author(s) See Also Examples

Description

Remove from either the environments related to calls to fill_akqenv or fill_dvenv a vector of site numbers and return a copy as an R list. This is a simple function saving marginally on number of lines of code for scripting by the user, but with the invert logical, flexibility of using akqdecay package is compressed into a simple operation.

Usage

1
akq_rm(siteNumbers, envir, invert=FALSE, ...)

Arguments

siteNumbers

A vector of USGS streamgage identification numbers. Any NA entries are removed and then a unique list of the site numbers is used. After the NA are removed and if then the length of the vector is zero, then as.list(envir) is returned with an informative warning message;

envir

The R environment previously populated by fill_akqenv or fill_dvenv;

invert

Instead of deleting and returning the remainder, with invert=TRUE, return an environment of sites identified by siteNumbers; and

...

Additional arguments to pass (see source code to ascertain flexible usage).

Value

An R list is returned. This list needs to be converted back to an environment using list2env after and not within this function because of memory inflation as R works to contain extra environmental information.

Author(s)

W.H. Asquith

See Also

fill_akqenv, fill_dvenv

Examples

1
2
3
4
5
6
7
8
sites <- c("05403500", "05405000") # Two USGS streamgages in Wisconsin
WisExample <- new.env(); fill_dvenv( sites,              envir=WisExample,
                                     sdate="1945-01-01", edate="2014-12-31")
WisAKQ <- new.env(); fill_akqenv(dvenv=WisExample, envir=WisAKQ)
nWisAKQ <- list2env(akq_rm("05405000", WisAKQ))
              akq_counts(nWisAKQ) # three columns removed below
#      site total_count decreases increases nochanges NAs
#  05403500       17713      8829      6023      2852   9 #

wasquith-usgs/akqdecay documentation built on Nov. 9, 2020, 1:13 p.m.