diff --git a/DESCRIPTION b/DESCRIPTION index 56554037..2fc759f9 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: tbeptools Title: Data and Indicators for the Tampa Bay Estuary Program Version: 3.0.0.9000 -Date: 2024-10-25 +Date: 2024-10-27 Authors@R: c( person(given = "Marcus", family = "Beck", diff --git a/R/read_formphyto.R b/R/read_formphyto.R index 2e611a06..6373cb1a 100644 --- a/R/read_formphyto.R +++ b/R/read_formphyto.R @@ -9,7 +9,7 @@ #' #' @importFrom dplyr %>% #' -#' @details Only seven taxonomic groups are summarized. Pyrodinium bahamense, Karenia brevis, Tripos hircus, Pseudo-nitzschia sp., and Pseudo-nitzschia pungens are retained at the species level. Bacillariophyta and Cyanobacteria are retained at the phylum level. All other taxa are grouped into an "other" category. +#' @details Only seven taxonomic groups are summarized. Pyrodinium bahamense, Karenia brevis, Tripos hircus, Pseudo-nitzschia sp., and Pseudo-nitzschia pungens are retained at the species level. Diatoms are summarized at the class level using Bacillariophyceae, Coscinodiscophyceae, and Mediophyceae and Cyanobacteria are summarized at the phylum level using Cyanobacteriota. All other taxa are grouped into an "other" category. #' #' @seealso \code{\link{read_importphyto}} #' @@ -19,7 +19,7 @@ #' xlsx <- '~/Desktop/phyto_data.xlsx' #' #' # load and assign to object -#' phytodata <- read_importphyto(xlsx) +#' phytodata <- read_importphyto(xlsx, download_latest = TRUE) #' } read_formphyto <- function(datin){ @@ -29,7 +29,7 @@ read_formphyto <- function(datin){ # format out <- datin %>% - dplyr::select(epchc_station = StationNumber, Date = SampleTime, phylum = PHYLUM, name = NAME, count = COUNT, units = Units) %>% + dplyr::select(epchc_station = StationNumber, Date = SampleTime, phylum = PHYLUM, class = CLASS, name = NAME, count = COUNT, units = Units) %>% dplyr::filter(epchc_station %in% !!stations) %>% dplyr::mutate( count = as.numeric(count), @@ -37,14 +37,14 @@ read_formphyto <- function(datin){ # qrt = quarter(Date, with_year = TRUE), name = dplyr::case_when( name %in% c('Pyrodinium bahamense', 'Karenia brevis', 'Tripos hircus', 'Pseudo-nitzschia sp.', 'Pseudo-nitzschia pungens') ~ name, - phylum %in% c('Bacillariophyta', 'Cyanobacteria') ~ phylum, - !is.na(phylum) ~ 'other', - T ~ NA_character_ + class %in% c('Bacillariophyceae', 'Coscinodiscophyceae', 'Mediophyceae') ~ 'Diatoms', + phylum %in% 'Cyanobacteriota' ~ 'Cyanobacteria', + T ~ 'other' ) ) %>% dplyr::filter(!is.na(name)) %>% dplyr::group_by(epchc_station, Date, name, units) %>% - dplyr::summarise(count = sum(count, na.rm = T)) %>% + dplyr::summarise(count = median(count, na.rm = T)) %>% dplyr::ungroup() %>% dplyr::mutate( yrqrt = lubridate::floor_date(Date, unit = 'quarter'), diff --git a/man/read_formphyto.Rd b/man/read_formphyto.Rd index 9b8c73a2..521eeb71 100644 --- a/man/read_formphyto.Rd +++ b/man/read_formphyto.Rd @@ -16,7 +16,7 @@ A formatted \code{data.frame} with phytoplankton count data Format phytoplankton data } \details{ -Only seven taxonomic groups are summarized. Pyrodinium bahamense, Karenia brevis, Tripos hircus, Pseudo-nitzschia sp., and Pseudo-nitzschia pungens are retained at the species level. Bacillariophyta and Cyanobacteria are retained at the phylum level. All other taxa are grouped into an "other" category. +Only seven taxonomic groups are summarized. Pyrodinium bahamense, Karenia brevis, Tripos hircus, Pseudo-nitzschia sp., and Pseudo-nitzschia pungens are retained at the species level. Diatoms are summarized at the class level using Bacillariophyceae, Coscinodiscophyceae, and Mediophyceae and Cyanobacteria are summarized at the phylum level using Cyanobacteriota. All other taxa are grouped into an "other" category. } \examples{ \dontrun{ @@ -24,7 +24,7 @@ Only seven taxonomic groups are summarized. Pyrodinium bahamense, Karenia brevis xlsx <- '~/Desktop/phyto_data.xlsx' # load and assign to object -phytodata <- read_importphyto(xlsx) +phytodata <- read_importphyto(xlsx, download_latest = TRUE) } } \seealso{ diff --git a/vignettes/intro.Rmd b/vignettes/intro.Rmd index a2bbf1d4..cb63329f 100644 --- a/vignettes/intro.Rmd +++ b/vignettes/intro.Rmd @@ -122,7 +122,7 @@ After the phytoplankton data are successfully imported, you can view them from t phytodata ``` -These data are highly summarized from the raw data file available online. Cell counts (as number of cells per 0.1mL) for selected taxa are summed for each station by quarters (i.e., Jan/Feb/Mar, Apr/May/Jun, etc.). The quarter is indicated in the `yrqrt` column specified by the starting date of each quarter (e.g., `1975-07-01` is the quarter Jul/Aug/Sep for 1975). These data are primarily used to support analyses in the water quality dashboard: +These data are highly summarized from the raw data file available online. Cell counts (as number of cells per 0.1mL) for selected taxa are shown by date and quarter (i.e., Jan/Feb/Mar, Apr/May/Jun, etc.) for each station. The quarter is indicated in the `yrqrt` column specified by the starting date of each quarter (e.g., `1975-07-01` is the quarter Jul/Aug/Sep for 1975). These data are primarily used to support analyses in the water quality dashboard: ### Retrieving additional water quality data