From 0b5c213b9682e1efe95c08a451e8c22f0c467563 Mon Sep 17 00:00:00 2001 From: Rebecca Wardrop Date: Mon, 24 Feb 2025 16:15:52 -0500 Subject: [PATCH] NNA progress adding defaults --- R/nna_progress.R | 17 ++++++++++------- man/NNA_progress.Rd | 16 +++++++++++----- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/R/nna_progress.R b/R/nna_progress.R index 5301188..486cb1d 100644 --- a/R/nna_progress.R +++ b/R/nna_progress.R @@ -3,15 +3,15 @@ #' To calculate progress towards the NNA goal. #' #' @param obi_dt OBI nightly export data. -#' @param start_date The start date of the time period for which you are interested in seeing NNA progress. Must be formatted as "YYYY-MM-DD". -#' @param end_date The end date of the time period for which you are interested in seeing NNA progress. Must be formatted as "YYYY-MM-DD". -#' @param OE_output A dataframe that contains the data read in from the O:E ratio .csv file. +#' @param start_date The start date of the time period for which you are interested in seeing NNA progress. Must be formatted as "YYYY-MM-DD". Default is "2024-10-01". +#' @param end_date The end date of the time period for which you are interested in seeing NNA progress. Must be formatted as "YYYY-MM-DD". Default is "2025-10-01". +#' @param OE_output The .csv file path to the O:E output. Default is the path for the 2025 O:E output: "OE_ratios/2025/current_OE_ratio_dt.xlsx". The turbo root path is automatically included. #' @param ... Grouping arguments. By default includes external_mdhhs_site_id and site_name. #' #' @return A dataframe with the progress towards the NNA goals during the selected timeframe. #' @examples #' /dontrun{ -#' NNA_progress( +#' NNA_output <- NNA_progress( #' obi_dt, #' start_date = "2024-10-01", #' end_date = "2024-11-10", @@ -25,10 +25,13 @@ #' -NNA_progress <- function(obi_dt, start_date, end_date, OE_output, ...){ +NNA_progress <- function( + obi_dt, start_date = "2024-10-01", + end_date = "2025-10-01", + OE_output = "OE_ratios/2025/current_OE_ratio_dt.xlsx", + ...){ - OE_output_nonames <- OE_output |> - select(-site_name) + OE_output_nonames <- readxl::read_excel(paste0(turbo_root_path(), OE_output)) obi_dt |> filter(infant_dob_dt >= start_date, infant_dob_dt < end_date) |> diff --git a/man/NNA_progress.Rd b/man/NNA_progress.Rd index 48a61cc..9c46bd5 100644 --- a/man/NNA_progress.Rd +++ b/man/NNA_progress.Rd @@ -4,16 +4,22 @@ \alias{NNA_progress} \title{NNA Progress} \usage{ -NNA_progress(obi_dt, start_date, end_date, OE_output, ...) +NNA_progress( + obi_dt, + start_date = "2024-10-01", + end_date = "2025-10-01", + OE_output = "OE_ratios/2025/current_OE_ratio_dt.xlsx", + ... +) } \arguments{ \item{obi_dt}{OBI nightly export data.} -\item{start_date}{The start date of the time period for which you are interested in seeing NNA progress. Must be formatted as "YYYY-MM-DD".} +\item{start_date}{The start date of the time period for which you are interested in seeing NNA progress. Must be formatted as "YYYY-MM-DD". Default is "2024-10-01".} -\item{end_date}{The end date of the time period for which you are interested in seeing NNA progress. Must be formatted as "YYYY-MM-DD".} +\item{end_date}{The end date of the time period for which you are interested in seeing NNA progress. Must be formatted as "YYYY-MM-DD". Default is "2025-10-01".} -\item{OE_output}{A dataframe that contains the data read in from the O:E ratio .csv file.} +\item{OE_output}{The .csv file path to the O:E output. Default is the path for the 2025 O:E output: "OE_ratios/2025/current_OE_ratio_dt.xlsx". The turbo root path is automatically included.} \item{...}{Grouping arguments. By default includes external_mdhhs_site_id and site_name.} } @@ -25,7 +31,7 @@ To calculate progress towards the NNA goal. } \examples{ /dontrun{ -NNA_progress( +NNA_output <- NNA_progress( obi_dt, start_date = "2024-10-01", end_date = "2024-11-10",