R/func_summarize_norwest.R

Defines functions summarize_norwest

Documented in summarize_norwest

#' Summarize NorWeST data available by PERMA_FID
#'
#' This function summarizes data available by year for a user-spcified
#' basin and site/PERMA_FID
#'
#' @param basin the site is within options are "Clearwater", "Salmon",
#' "SpoKoot", "MidSnake", "SnakeBear"
#' @param site PERMA_FID
#' @return tibble with one row per PERMA_FID/year combination
#' @examples summarize_norwest(Clearwater, 1214)
#' @export

summarize_norwest <-function(basin, site) {

  basin %>%
    dplyr::filter(PERMA_FID == {{site}}) %>%
    dplyr::group_by(PERMA_FID, GNIS_NAME, OBSPRED_ID, SampleYear) %>%
    dplyr::summarise(`Start Date` = as.Date(min(SampleDate), format = "%Y-%m-%d"),
              `End Date` = as.Date(max(SampleDate), format = "%Y-%m-%d"),
              Days = dplyr::n_distinct(SampleDate),
              MinTempC = min(DailyMin),
              MaxTempC = max(DailyMax),
              `Min Obs per day` = min(Nobs),
              `Max Obs per day` = max(Nobs))

}
jjwill2/idtemp documentation built on Aug. 10, 2020, 12:44 a.m.