Title: | Analysis Tools for Importing, Wrangling, and Summarizing Suffolk County Water Quality Data |
---|---|
Description: | Analysis tools for importing, wrangling, and summarizing Suffolk County water quality data. Functions are used to create reporting materials. |
Authors: | Marcus Beck [aut, cre] , Gerold Morrison [aut], Holly Greening [aut] |
Maintainer: | Marcus Beck <[email protected]> |
License: | CC0 |
Version: | 1.1.0 |
Built: | 2024-12-08 05:37:15 UTC |
Source: | https://github.com/tbep-tech/peptools |
Get attainment categories for each year and bay segment using chlorophyll and secchi depth
anlz_attainpep(meddat, magdurout = FALSE, trgs = NULL)
anlz_attainpep(meddat, magdurout = FALSE, trgs = NULL)
meddat |
result returned from |
magdurout |
logical indicating if the separate magnitude and duration estimates are returned |
trgs |
optional |
A data.frame
for each year and bay segment showing the attainment category
meddat <- anlz_medpep(rawdat) anlz_attainpep(meddat)
meddat <- anlz_medpep(rawdat) anlz_attainpep(meddat)
Analyze daily DO values relative to threshold
anlz_dodlypep(dodat, thr = 3, impute = TRUE)
anlz_dodlypep(dodat, thr = 3, impute = TRUE)
dodat |
result returned from |
thr |
numeric indicating appropriate dissolved oxygen thresholds, usually 3 mg/L for acute, 4.8 mg/L for chronic |
impute |
logical indicating of missing dissolved oxygen values are imputed with the year, month, site average |
The dodat
data object can be used as input without downloading USGS data
If impute = TRUE
, missing dissolved oxygen values in the complete daily time series are imputed to the average for the year, month, site combination. This is often necessary to create summary values that make sense. For example, if a month has incomplete data, the maximum below_cumsum
value will not show 30 or 31 days even if every day in the observed record is below the threshold.
data.frame
data(dodat) dat <- anlz_dodlypep(dodat) dat
data(dodat) dat <- anlz_dodlypep(dodat) dat
Analyze monthly DO values relative to threshold
anlz_domopep(dodat, thr = 3, impute = TRUE)
anlz_domopep(dodat, thr = 3, impute = TRUE)
dodat |
result returned from |
thr |
numeric indicating appropriate dissolved oxygen thresholds, usually 3 mg/L for acute, 4.8 mg/L for chronic |
impute |
logical indicating of missing dissolved oxygen values are imputed with the year, month, site average |
The dodat
data object can be used as input without downloading USGS data
The date are summarized as three different values, where do_mgl
is the average of all daily DO averages across the month, below_ave
is the proportion of days in a month when concentrations in a given day fell below the threshold (1 would mean all days had an instance of DO below the threshold, 0 would mean none), and below_maxrun
is the maximum number of sequential days in a month when concentrations in a given day fell below the threshold (30 or 31, depending on month, would indicate all days in a month had an instance of DO below the threshold).
If impute = TRUE
, missing dissolved oxygen values in the complete daily time series are imputed to the average for the year, month, site combination. This is often necessary to create summary values that make sense. For example, if a month has incomplete data, the below_ave
summary may indicate a value of one if all daily averages in the available data are below the threshold, whereas the below_maxrun
summary may indicate a maximum run of days not equal to the number of days in the month.
data.frame
data(dodat) dat <- anlz_domopep(dodat) dat
data(dodat) dat <- anlz_domopep(dodat) dat
Count beach exceedances for enterococcus
anlz_entpep(entdat, thr = 104)
anlz_entpep(entdat, thr = 104)
entdat |
result returned from |
thr |
numeric value defining threshold for exceedance |
The exceedance threshold is set by default as 104 cfu/100 ml criterion. This is simply based on counts in a year when any value at any station was above the threshold for each 24 hour period in the record.
The samples
column shows how many days of the year were sampled at each beach and the exceedances
column shows how many samples were above the threshold.
A data.frame
with counts of exceedances per year for each beach
anlz_entpep(entdat)
anlz_entpep(entdat)
Estimate annual medians by segment for chlorophyll, secchi, and total nitrogen data
anlz_medpep(dat)
anlz_medpep(dat)
dat |
|
Median estimates for chlorophyll, secchi, and total nitrogen
# view median estimates anlz_medpep(rawdat)
# view median estimates anlz_medpep(rawdat)
Bathing beaches
beaches
beaches
A data.frame
object
## Not run: library(sf) library(dplyr) beaches <- read.csv('inst/extdata/beaches.csv') %>% st_as_sf( coords = c('Longitude', 'Latitude'), crs = '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs' ) save(beaches, file = 'data/beaches.RData') ## End(Not run)
## Not run: library(sf) library(dplyr) beaches <- read.csv('inst/extdata/beaches.csv') %>% st_as_sf( coords = c('Longitude', 'Latitude'), crs = '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs' ) save(beaches, file = 'data/beaches.RData') ## End(Not run)
Dissolved oxygen data for USGS stations
dodat
dodat
A data.frame
object
## Not run: # 01304562 is Peconic River, 01304200 is Orient Harbor, 01304650 is Shelter Island dodat <- read_pepdo(site = c('01304562', '01304200', '01304650'), nms = c('Peconic River', 'Orient Harbor', 'Shelter Island')) save(dodat, file = 'data/dodat.RData', compress = 'xz') ## End(Not run)
## Not run: # 01304562 is Peconic River, 01304200 is Orient Harbor, 01304650 is Shelter Island dodat <- read_pepdo(site = c('01304562', '01304200', '01304650'), nms = c('Peconic River', 'Orient Harbor', 'Shelter Island')) save(dodat, file = 'data/dodat.RData', compress = 'xz') ## End(Not run)
Raw beach pathogen data from Suffolk County
entdat
entdat
A data.frame
object
## Not run: library(dplyr) entdat1 <- read_pepent() %>% filter(lubridate::year(Date) < 2022) entdat2 <- read_pepent(path = '~/Desktop/Enterodata_2023.xlsx') %>% filter(lubridate::year(Date) >= 2022) entdat <- bind_rows(entdat1, entdat2) save(entdat, file = 'data/entdat.RData', compress = 'xz') # or the file can be manually downloaded from here (format is not the same as path input from SCM) # https://gis.suffolkcountyny.gov/portal/home/item.html?id=e3b344ff82b74762b625cacaa3e9621a entdat <- read.csv('~/Desktop/Beach_Water_Quality_Data.csv', header = T) |> dplyr::filter(Type %in% c('Enterococcus', 'Enterococci')) %>% dplyr::select( Name, FieldNum, Date = ColDate, value = Result, status = Character ) %>% dplyr::mutate( status = gsub('[[:digit:]]+|\\.', '', value), status = ifelse(status == '', '=', status), value = as.numeric(gsub('>|<', '', value)), Date = suppressWarnings({dplyr::case_when( grepl('\\/', Date) ~ lubridate::mdy(Date), grepl("^[[:digit:]]+$", Date) ~ as.Date(as.numeric(Date), origin = "1899-12-30"), T ~ NA )}), Name = dplyr::case_when( Name == 'Crescent Beach - Shelter Island' ~ 'Crescent Beach - Suffolk', T ~ Name ) ) %>% dplyr::filter(Name %in% beaches$Name) |> dplyr::arrange(Name, FieldNum, Date) save(entdat, file = 'data/entdat.RData') ## End(Not run)
## Not run: library(dplyr) entdat1 <- read_pepent() %>% filter(lubridate::year(Date) < 2022) entdat2 <- read_pepent(path = '~/Desktop/Enterodata_2023.xlsx') %>% filter(lubridate::year(Date) >= 2022) entdat <- bind_rows(entdat1, entdat2) save(entdat, file = 'data/entdat.RData', compress = 'xz') # or the file can be manually downloaded from here (format is not the same as path input from SCM) # https://gis.suffolkcountyny.gov/portal/home/item.html?id=e3b344ff82b74762b625cacaa3e9621a entdat <- read.csv('~/Desktop/Beach_Water_Quality_Data.csv', header = T) |> dplyr::filter(Type %in% c('Enterococcus', 'Enterococci')) %>% dplyr::select( Name, FieldNum, Date = ColDate, value = Result, status = Character ) %>% dplyr::mutate( status = gsub('[[:digit:]]+|\\.', '', value), status = ifelse(status == '', '=', status), value = as.numeric(gsub('>|<', '', value)), Date = suppressWarnings({dplyr::case_when( grepl('\\/', Date) ~ lubridate::mdy(Date), grepl("^[[:digit:]]+$", Date) ~ as.Date(as.numeric(Date), origin = "1899-12-30"), T ~ NA )}), Name = dplyr::case_when( Name == 'Crescent Beach - Shelter Island' ~ 'Crescent Beach - Suffolk', T ~ Name ) ) %>% dplyr::filter(Name %in% beaches$Name) |> dplyr::arrange(Name, FieldNum, Date) save(entdat, file = 'data/entdat.RData') ## End(Not run)
Polygon shapefile of segment boundaries
pepseg
pepseg
A sf
object
## Not run: library(sf) library(dplyr) pepseg <- st_read('~/Desktop/TBEP/Peconic/PEPSegments/PEP_Seg_Reeves.shp') %>% st_transform(crs = '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs') %>% select(bay_segment = NewSegment) %>% st_buffer(dist = 0) %>% st_crop(xmin = -72.76, xmax = -71.8, ymin = 40.83, ymax = 41.2) save(pepseg, file = 'data/pepseg.RData', compress = 'xz') ## End(Not run)
## Not run: library(sf) library(dplyr) pepseg <- st_read('~/Desktop/TBEP/Peconic/PEPSegments/PEP_Seg_Reeves.shp') %>% st_transform(crs = '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs') %>% select(bay_segment = NewSegment) %>% st_buffer(dist = 0) %>% st_crop(xmin = -72.76, xmax = -71.8, ymin = 40.83, ymax = 41.2) save(pepseg, file = 'data/pepseg.RData', compress = 'xz') ## End(Not run)
Bay stations by segment
pepstations
pepstations
A data.frame
object
## Not run: library(tidyr) library(sf) library(dplyr) library(readxl) library(mapedit) library(mapview) prj <- 4326 locs <- read_xlsx('inst/extdata/stationmeta.xlsx') %>% select(BayStation = `Station Number`, StationName, Longitude = LON, Latitude = LAT) %>% mutate( BayStation = as.character(BayStation) ) %>% sf::st_as_sf(coords = c("Longitude", "Latitude"), crs = prj) # # use this for spatial selection # p <- mapview(pepseg) + mapview(locs) # e1 <- editMap(p) # locs[e1$finished, ] %>% pull(BayStation) %>% dput pepstations <- list( `1a` = c("60280", "60275", "60270", "60265", "60266", "60260", "60250", "60240", "60230", "60210", "60220"), `1b` = c("60170", "60101", "60130", "60290", "60148"), `2` = c("60102", "60103", "60113", "60104", "60300", "60105", "60106", "60107", "60310", "60320", "60114", "60109", "60340", "60121", "60124", "60119", "60127", "60126", "60111", "60131", "60118"), `3` = c("60122", "60115", "60116", "60330", "60132", "60137", "60133", "60134", "60135") ) %>% tibble::enframe('bay_segment', 'BayStation') %>% unnest(BayStation) %>% left_join(locs, ., by = 'BayStation') crds <- st_coordinates(pepstations) pepstations <- pepstations %>% st_set_geometry(NULL) %>% mutate( Longitude = crds[, 1], Latitude = crds[, 2], bay_segment = factor(bay_segment, levels = c('1a', '1b', '2', '3')) ) save(pepstations, file = 'data/pepstations.RData', compress = 'xz') ## End(Not run)
## Not run: library(tidyr) library(sf) library(dplyr) library(readxl) library(mapedit) library(mapview) prj <- 4326 locs <- read_xlsx('inst/extdata/stationmeta.xlsx') %>% select(BayStation = `Station Number`, StationName, Longitude = LON, Latitude = LAT) %>% mutate( BayStation = as.character(BayStation) ) %>% sf::st_as_sf(coords = c("Longitude", "Latitude"), crs = prj) # # use this for spatial selection # p <- mapview(pepseg) + mapview(locs) # e1 <- editMap(p) # locs[e1$finished, ] %>% pull(BayStation) %>% dput pepstations <- list( `1a` = c("60280", "60275", "60270", "60265", "60266", "60260", "60250", "60240", "60230", "60210", "60220"), `1b` = c("60170", "60101", "60130", "60290", "60148"), `2` = c("60102", "60103", "60113", "60104", "60300", "60105", "60106", "60107", "60310", "60320", "60114", "60109", "60340", "60121", "60124", "60119", "60127", "60126", "60111", "60131", "60118"), `3` = c("60122", "60115", "60116", "60330", "60132", "60137", "60133", "60134", "60135") ) %>% tibble::enframe('bay_segment', 'BayStation') %>% unnest(BayStation) %>% left_join(locs, ., by = 'BayStation') crds <- st_coordinates(pepstations) pepstations <- pepstations %>% st_set_geometry(NULL) %>% mutate( Longitude = crds[, 1], Latitude = crds[, 2], bay_segment = factor(bay_segment, levels = c('1a', '1b', '2', '3')) ) save(pepstations, file = 'data/pepstations.RData', compress = 'xz') ## End(Not run)
Bay segment targets
peptargets
peptargets
A data.frame
object
## Not run: peptargets <- tibble::tibble( bay_segment = factor(c('1a', '1b', '2', '3'), levels = c('1a', '1b', '2', '3')), name = factor(c('1a', '1b', '2', '3'), levels = c('1a', '1b', '2', '3')), sd_thresh = c(6.5, 6.5, 6.5, 6.5), chla_thresh = c(5.5, 5.5, 5.5, 5.5), tn_thresh = c(0.4, 0.4, 0.4, 0.4) ) save(peptargets, file = 'data/peptargets.RData', compress= 'xz') ## End(Not run)
## Not run: peptargets <- tibble::tibble( bay_segment = factor(c('1a', '1b', '2', '3'), levels = c('1a', '1b', '2', '3')), name = factor(c('1a', '1b', '2', '3'), levels = c('1a', '1b', '2', '3')), sd_thresh = c(6.5, 6.5, 6.5, 6.5), chla_thresh = c(5.5, 5.5, 5.5, 5.5), tn_thresh = c(0.4, 0.4, 0.4, 0.4) ) save(peptargets, file = 'data/peptargets.RData', compress= 'xz') ## End(Not run)
Raw data from Suffolk County
rawdat
rawdat
A data.frame
object
## Not run: path <- system.file("extdata", "currentdata.xlsx", package="peptools") rawdat <- read_pepwq(path) save(rawdat, file = 'data/rawdat.RData', compress = 'xz') ## End(Not run)
## Not run: path <- system.file("extdata", "currentdata.xlsx", package="peptools") rawdat <- read_pepwq(path) save(rawdat, file = 'data/rawdat.RData', compress = 'xz') ## End(Not run)
Import dissolved oxygen data
read_pepdo( site = c("01304562", "01304200", "01304650"), nms = c("Peconic River", "Orient Harbor", "Shelter Island"), startDate = "2013-01-01", endDate = "2023-12-31" )
read_pepdo( site = c("01304562", "01304200", "01304650"), nms = c("Peconic River", "Orient Harbor", "Shelter Island"), startDate = "2013-01-01", endDate = "2023-12-31" )
site |
chr string of site numbers for USGS stations |
nms |
chr string vector of names to reassign to site numbers |
startDate |
chr string of start date in YYYY-MM-DD |
endDate |
chr string of end date in YYYY-MM-DD |
Raw data are downloaded using the USGS dataRetrieval R package, this function is a simple wrapper to the readNWISuv
function.
Note that downloading the station data with the default arguments may take a few minutes. Sites are 01304562 for Peconic River, 01304200 for Orient Harbor, 01304650 for Shelter Island.
data.frame
## Not run: dodat <- read_pepdo(site = c('01304562', '01304200', '01304650'), nms = c('Peconic River', 'Orient Harbor', 'Shelter Island'), StartDate = '2020-06-01', endDate = '2021-06-30') dodat ## End(Not run)
## Not run: dodat <- read_pepdo(site = c('01304562', '01304200', '01304650'), nms = c('Peconic River', 'Orient Harbor', 'Shelter Island'), StartDate = '2020-06-01', endDate = '2021-06-30') dodat ## End(Not run)
Import raw enterococcus data
read_pepent(path = NULL)
read_pepent(path = NULL)
path |
chr string of path for excel file (optional) |
Data are from the ArcGIS REST Services here https://gis.suffolkcountyny.gov/hosted/rest/services/Hosted/Beach_Water_Quality_Data/FeatureServer/.
The API is queried by beach names in the beaches
data object. The queries are done individually for each beach to not exceed the 2000 record limit.
Data can also be imported from an Excel if the path
argument is used for the location to the file.
data.frame
## Not run: entdat <- read_pepent() ## End(Not run) head(entdat)
## Not run: entdat <- read_pepent() ## End(Not run) head(entdat)
Import raw water quality data
read_pepwq(path)
read_pepwq(path)
path |
chr string of path for excel file |
Raw data from here https://gis.suffolkcountyny.gov/portal/home/item.html?id=5d4b53ec44204219a8da685f1859e096
All data prior to 1990 are removed - some exist but the data are scarce.
data.frame
path <- system.file("extdata", "currentdata.xlsx", package="peptools") dat <- read_pepwq(path) dat
path <- system.file("extdata", "currentdata.xlsx", package="peptools") dat <- read_pepwq(path) dat
Plot annual water quality values and thresholds for all bay segments
show_allthrpep( dat, param = c("chla", "sd", "tn"), trgs = NULL, yrrng = NULL, family = NA, labelexp = TRUE, txtlab = TRUE )
show_allthrpep( dat, param = c("chla", "sd", "tn"), trgs = NULL, yrrng = NULL, family = NA, labelexp = TRUE, txtlab = TRUE )
dat |
data frame of data returned by |
param |
chr string indicating which water quality value and appropriate threshold to plot, one of "chla" for chlorophyll, "sd" for secchi depth, or "tn" for total nitrogen |
trgs |
optional |
yrrng |
numeric vector indicating min, max years to include |
family |
optional chr string indicating font family for text labels |
labelexp |
logical indicating if y axis and target labels are plotted as expressions, default |
txtlab |
logical indicating if a text label for the target value is shown in the plot |
This function is conceptually similar to show_thrpep
, but results are shown as annual medians across all bay segments for the selected parameter.
A ggplot
object
show_allthrpep(rawdat, param = 'chl')
show_allthrpep(rawdat, param = 'chl')
Plot monthly chlorophyl, secchi, or tn values values for a bay segment
show_boxpep( dat, param = c("chla", "sd", "tn"), yrsel = NULL, yrrng = NULL, ptsz = 0.5, bay_segment = c("1a", "1b", "2", "3"), trgs = NULL, family = NA, labelexp = TRUE, txtlab = TRUE )
show_boxpep( dat, param = c("chla", "sd", "tn"), yrsel = NULL, yrrng = NULL, ptsz = 0.5, bay_segment = c("1a", "1b", "2", "3"), trgs = NULL, family = NA, labelexp = TRUE, txtlab = TRUE )
dat |
data frame of data returned by |
param |
chr string indicating which water quality value and appropriate threshold to plot, one of "chla" for chlorophyll, "sd" for secchi depth, or "tn" for total nitrogen |
yrsel |
numeric for year to emphasize, shown as separate red points on the plot |
yrrng |
numeric vector indicating min, max years to include |
ptsz |
numeric indicating point size of observations not in |
bay_segment |
chr string for the bay segment, one of "1a", "1b", "2", or "3" |
trgs |
optional |
family |
optional chr string indicating font family for text labels |
labelexp |
logical indicating if y axis and target labels are plotted as expressions, default |
txtlab |
logical indicating if a text label for the target value is shown in the plot |
Points not included in yrsel
are plotted over the box plots using position_jitter
. Use ptsz = -1
to suppress.
A ggplot
object
show_boxpep(rawdat, bay_segment = '1a')
show_boxpep(rawdat, bay_segment = '1a')
Create a colorized table for reporting dissolved oxygen data by site
show_domatrix( dodat, site, show = c("below_ave", "below_maxrun"), txtsz = 3, thr = 4.8, impute = TRUE, yrrng = NULL, family = NA )
show_domatrix( dodat, site, show = c("below_ave", "below_maxrun"), txtsz = 3, thr = 4.8, impute = TRUE, yrrng = NULL, family = NA )
dodat |
data frame of dissolved oxygen data returned by |
site |
character string of the site to plot taken from the |
show |
chr string indicating which summary value to plot from |
txtsz |
numeric for size of text in the plot, applies only if |
thr |
numeric indicating appropriate dissolved oxygen thresholds, usually 3 mg/L for acute, 4.8 mg/L for chronic |
impute |
logical indicating of missing dissolved oxygen values are imputed with the year, month, site average |
yrrng |
numeric vector indicating min, max years to include |
family |
optional chr string indicating font family for text labels |
A static ggplot
object is returned.
show_domatrix(dodat, site = 'Peconic River')
show_domatrix(dodat, site = 'Peconic River')
Create a colorized table for beach pathogen exceedances
show_entmatrix(entdat, txtsz = 2, thr = 104, yrrng = NULL, family = NA)
show_entmatrix(entdat, txtsz = 2, thr = 104, yrrng = NULL, family = NA)
entdat |
data frame of enterococcus data returned by |
txtsz |
numeric for size of text in the plot, applies only if |
thr |
numeric value defining threshold for exceedance |
yrrng |
numeric vector indicating min, max years to include |
family |
optional chr string indicating font family for text labels |
A static ggplot
object is returned if asreact = FALSE
, otherwise a reactable
table is returned
show_entmatrix(entdat)
show_entmatrix(entdat)
Create a colorized table for indicator reporting
show_matrixpep( dat, txtsz = 3, trgs = NULL, yrrng = NULL, bay_segment = c("1a", "1b", "2", "3"), asreact = FALSE, nrows = 10, abbrev = FALSE, family = NA )
show_matrixpep( dat, txtsz = 3, trgs = NULL, yrrng = NULL, bay_segment = c("1a", "1b", "2", "3"), asreact = FALSE, nrows = 10, abbrev = FALSE, family = NA )
dat |
data frame of water quality data returned by |
txtsz |
numeric for size of text in the plot, applies only if |
trgs |
optional |
yrrng |
numeric vector indicating min, max years to include |
bay_segment |
chr string for bay segments to include, one to all of "1a", "1b", "2", or "3" |
asreact |
logical indicating if a |
nrows |
if |
abbrev |
logical indicating if text labels in the plot are abbreviated as the first letter |
family |
optional chr string indicating font family for text labels |
A static ggplot
object is returned if asreact = FALSE
, otherwise a reactable
table is returned
show_matrixpep(rawdat)
show_matrixpep(rawdat)
Plot chlorophyll and secchi data together with matrix outcomes
show_plotlypep( dat, bay_segment = c("1a", "1b", "2", "3"), yrrng = NULL, chllim = NULL, seclim = NULL )
show_plotlypep( dat, bay_segment = c("1a", "1b", "2", "3"), yrrng = NULL, chllim = NULL, seclim = NULL )
dat |
|
bay_segment |
chr string for the bay segment, one of "1a", "1b", "2", or "3" |
yrrng |
numeric for year range to plot |
chllim |
numeric vector of length two indicating range for the chlorophyll y-axis |
seclim |
numeric vector of length two indicating range for the secchi y-axis |
An interactive plotly object
show_plotlypep(rawdat)
show_plotlypep(rawdat)
Create reactable table from matrix data
show_reactablepep(totab, colfun, nrows = 10)
show_reactablepep(totab, colfun, nrows = 10)
totab |
A data frame in wide format of summarized results |
colfun |
Function specifying how colors are treated in cell background |
nrows |
numeric specifying number of rows in the table |
This function is used internally within show_matrixpep
A reactable
table
Create a colorized table for water quality outcomes by segment that includes the management action and chlorophyll, and secchi exceedances
show_segmatrixpep( dat, txtsz = 3, trgs = NULL, yrrng = NULL, bay_segment = c("1a", "1b", "2", "3"), abbrev = FALSE, family = NA )
show_segmatrixpep( dat, txtsz = 3, trgs = NULL, yrrng = NULL, bay_segment = c("1a", "1b", "2", "3"), abbrev = FALSE, family = NA )
dat |
|
txtsz |
numeric for size of text in the plot, applies only if |
trgs |
optional |
yrrng |
numeric vector indicating min, max years to include |
bay_segment |
chr string for bay segments to include, one to all of "1a", "1b", "2", or "3" |
abbrev |
logical indicating if text labels in the plot are abbreviated as the first letter, applies only to center column |
family |
optional chr string indicating font family for text labels |
This function provides a combined output for the show_wqmatrixpep
and show_matrixpep
functions. Only one bay segment can be plotted for each function call.
A static ggplot
object is returned
show_wqmatrixpep
, show_matrixpep
show_segmatrixpep(rawdat, bay_segment = '1a')
show_segmatrixpep(rawdat, bay_segment = '1a')
Map water quality data for a selected year
show_sitemappep( dat, yrsel = NULL, mosel = NULL, param = c("chla", "sd", "tn"), bay_segment = c("1a", "1b", "2", "3"), maxrel = 0.99, relative = FALSE )
show_sitemappep( dat, yrsel = NULL, mosel = NULL, param = c("chla", "sd", "tn"), bay_segment = c("1a", "1b", "2", "3"), maxrel = 0.99, relative = FALSE )
dat |
data frame of data returned by |
yrsel |
numeric for years to plot, see details |
mosel |
numeric for months to plot, see details |
param |
chr string indicating which water quality value to plot, one of "chla" for chlorophyll, "sd" for secchi depth, or "tn" for total nitrogen |
bay_segment |
chr string for the bay segment, one or all of "1a", "1b", "2", or "3" |
maxrel |
numeric for the maximum quantile value for scaling if |
relative |
logical indicating if sizes and colors are relative to the entire water quality data base, otherwise scaling is relative only for the points on the map |
Year estimates for the selected parameter are based on median observations across months. All twelve months are used if mosel = NULL
(default). Monthly estimates for the selected parameter are based on median observations across years. All years are used if yrsel = NULL
(default).
The color ramp and size scaling of points are reversed for Secchi observations.
A leaflet
object
# 2018, all months show_sitemappep(rawdat, yrsel = 2018) # 2018, July only show_sitemappep(rawdat, yrsel = 2018, mosel = 7) # July only, all years show_sitemappep(rawdat, mosel = 7)
# 2018, all months show_sitemappep(rawdat, yrsel = 2018) # 2018, July only show_sitemappep(rawdat, yrsel = 2018, mosel = 7) # July only, all years show_sitemappep(rawdat, mosel = 7)
Plot annual water quality values and thresholds for a bay segment
show_thrpep( dat, bay_segment = c("1a", "1b", "2", "3"), param = c("chla", "sd", "tn"), ylim = NULL, trgs = NULL, yrrng = NULL, family = NA, labelexp = TRUE, txtlab = TRUE )
show_thrpep( dat, bay_segment = c("1a", "1b", "2", "3"), param = c("chla", "sd", "tn"), ylim = NULL, trgs = NULL, yrrng = NULL, family = NA, labelexp = TRUE, txtlab = TRUE )
dat |
data frame of data returned by |
bay_segment |
chr string for the bay segment, one of "1a", "1b", "2", or "3" |
param |
chr string indicating which water quality value and appropriate threshold to plot, one of "chla" for chlorophyll, "sd" for secchi depth, or "tn" for total nitrogen |
ylim |
numeric vector of length two indicating range for the y-axis |
trgs |
optional |
yrrng |
numeric vector indicating min, max years to include |
family |
optional chr string indicating font family for text labels |
labelexp |
logical indicating if y axis and target labels are plotted as expressions, default |
txtlab |
logical indicating if a text label for the target value is shown in the plot |
A ggplot
object
show_thrpep(rawdat, bay_segment = '1a', param = 'chl')
show_thrpep(rawdat, bay_segment = '1a', param = 'chl')
Create a colorized table for chlorophyll or secchi exceedances
show_wqmatrixpep( dat, param = c("chla", "sd"), txtsz = 3, trgs = NULL, yrrng = NULL, alpha = 1, bay_segment = c("1a", "1b", "2", "3"), asreact = FALSE, nrows = 10, family = NA )
show_wqmatrixpep( dat, param = c("chla", "sd"), txtsz = 3, trgs = NULL, yrrng = NULL, alpha = 1, bay_segment = c("1a", "1b", "2", "3"), asreact = FALSE, nrows = 10, family = NA )
dat |
|
param |
chr string for which parameter to plot, one of |
txtsz |
numeric for size of text in the plot, applies only if |
trgs |
optional |
yrrng |
numeric vector indicating min, max years to include |
alpha |
numeric indicating color transparency |
bay_segment |
chr string for bay segments to include, one to all of "1a", "1b", "2", or "3" |
asreact |
logical indicating if a |
nrows |
if |
family |
optional chr string indicating font family for text labels |
A static ggplot
object is returned if asreact = FALSE
, otherwise a reactable
table is returned
show_matrixpep
, show_segmatrixpep
show_wqmatrixpep(rawdat)
show_wqmatrixpep(rawdat)