utilMWRfilter {MassWateR} | R Documentation |
Filter results data by parameter, date range, site, result attributes, and/or location group
Description
Filter results data by parameter, date range, site, result attributes, and/or location group
Usage
utilMWRfilter(
resdat,
sitdat = NULL,
param,
dtrng = NULL,
site = NULL,
resultatt = NULL,
locgroup = NULL,
alllocgroup = FALSE,
allresultatt = FALSE
)
Arguments
resdat |
results data as returned by |
sitdat |
site metadata file as returned by |
param |
character string to filter results by a parameter in |
dtrng |
character string of length two for the date ranges as YYYY-MM-DD |
site |
character string of sites to include, default all |
resultatt |
character string of result attributes to include, default all |
locgroup |
character string of location groups to include from the |
alllocgroup |
logical indicating if results data are filtered by all location groups in |
allresultatt |
logical indicating if results data are filtered by all result attributes if |
Value
resdat
filtered by param
, dtrng
, site
, resultatt
, and/or locgroup
, otherwise resdat
filtered only by param
if other arguments are NULL
Examples
# results file path
respth <- system.file('extdata/ExampleResults.xlsx', package = 'MassWateR')
# results data
resdat <- readMWRresults(respth)
# site data path
sitpth <- system.file('extdata/ExampleSites.xlsx', package = 'MassWateR')
# site data
sitdat <- readMWRsites(sitpth)
# filter by parameter, date range
utilMWRfilter(resdat, param = 'DO', dtrng = c('2022-06-01', '2022-06-30'))
# filter by parameter, site
utilMWRfilter(resdat, param = 'DO', site = c('ABT-026', 'ABT-062', 'ABT-077'))
# filter by parameter, result attribute
utilMWRfilter(resdat, param = 'DO', resultatt = 'DRY')
# filter by parameter, location group, date range
utilMWRfilter(resdat, param = 'DO', sitdat = sitdat,
locgroup = 'Assabet', dtrng = c('2022-06-01', '2022-06-30'))