R/adcp_write_report_table.R

Defines functions adcp_write_report_table

Documented in adcp_write_report_table

#' Writes deployment table for summary report
#'
#' @param metadata Deployment metadata from the NSDFA tracking sheet.
#'
#' @return Returns a tibble with three columns: \code{DEPLOYMENT},
#'   \code{Depl_Date}, and \code{Station_Name}.
#'
#' @importFrom dplyr if_else mutate select tibble
#'
#' @export

adcp_write_report_table <- function(metadata) {
  metadata %>%
    tibble() %>%
    select(
      Station = Station_Name,
      `Instrument Model` = Inst_Model,
      Latitude = Depl_Lat, Longitude = Depl_Lon,
      `Deployment Date` = Depl_Date, `Recovery Date` = Recv_Date,
      `Duration (d)` = Depl_Duration,
      `Depth Sounding (m)` = Depl_Sounding,
      `Ensemble Intervals (s)` = Current_Ensemble_Interval_s,
      `Averaging Intervals (s)` = Current_Averaging_Interval_s,
      `Pings per Ensemble` = Current_PingsPerEnsemble,
      `Bin Size (m)` = Bin_Size,
      `First Bin Range (m)` = First_Bin_Range
    ) %>%
    mutate(
      `Depth Sounding (m)` = as.character(`Depth Sounding (m)`),
      `Depth Sounding (m)` = if_else(
        is.na(`Depth Sounding (m)`), "Not recorded", `Depth Sounding (m)`
      )
    )
}
dempsey-CMAR/adcp documentation built on April 17, 2025, 4:30 a.m.