Skip to content

Commit

Permalink
added enterodata_since1995 and associated documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
swmpkim committed Jul 13, 2024
1 parent a2f6386 commit 75d31f9
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 0 deletions.
25 changes: 25 additions & 0 deletions R/enterodata_since1995.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#' Enterococcus data from 53 key Enterococcus stations since 1995
#'
#' Note, the data frame was created and named with 1995-2023 as the date range in the Water Quality Portal call, but the first actual date is 2 Aug 2000.
#'
#' @format A data frame with 6207 rows and 12 columns:
#' \describe{
#' \item{date}{data, sample date}
#' \item{station}{character, sample station, as named in the Water Quality Portal}
#' \item{ecocci}{numeric, sample's Enterococcus concentration}
#' \item{ecocci_censored}{logical, whether sample concentration was censored (below detection limit)}
#' \item{Latitude}{numeric, latitude in decimal degrees}
#' \item{Longitude}{numeric, longitude in decimal degrees}
#' \item{ecocci_units}{character, units of measurement of Enterococcus}
#' \item{time}{character, time sample was obtained, in 24hr format}
#' \item{time_zone}{character, time zone of sample time}
#' \item{MDL}{numeric, minimum detection limit of laboratory for Enterococcus}
#' \item{yr}{numeric year of sample date}
#' \item{mo}{numeric month of sample date}
#' }
#' @details
#' A sample dataset containing Enterococcus from 53 stations in the TBEP watershed from 2000-2023. Generated by \code{data-raw/enterodata_since1995-raw.R} (view on github: \url{https://github.com/tbep-tech/tbeptools/blob/master/data-raw/enterodata_since1995-raw.R})
#' @source Water Quality Portal, \url{https://waterqualitydata.us}
#'

"enterodata_since1995"
22 changes: 22 additions & 0 deletions data-raw/enterodata_since1995-raw.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# all data from key Enterococcus stations, 1995-2023
# although apparently data collection only started in 2000 at the earliest of these stations

stations <- unique(catch_precip$station)
entero_names <- c('Enterococci',
'Enterococcus')
startDate <- as.Date('1995-01-01')
endDate <- as.Date('2023-12-31')

args <- list(
siteid = stations,
characteristicName = entero_names,
startDateLo = format(startDate, '%m-%d-%Y'),
startDateHi = format(endDate, '%m-%d-%Y')
)
# date format has to be mm-dd-yyyy

enterodata_since1995 <- read_importentero(args = args) %>%
dplyr::select(-qualifier,
-LabComments)

save(enterodata_since1995, file = 'data/enterodata_since1995.RData', compress = 'xz')
Binary file added data/enterodata_since1995.RData
Binary file not shown.
36 changes: 36 additions & 0 deletions man/enterodata_since1995.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 75d31f9

Please sign in to comment.