From 32ad625e00aedae119373c33a91a79323c515bef Mon Sep 17 00:00:00 2001 From: almac2022 Date: Mon, 16 Dec 2024 10:22:24 -0800 Subject: [PATCH] improve documentation to reference fpr_chk_dupes --- R/fpr_tidy_assign_site_id.R | 12 ++++++++++-- man/fpr_tidy_assign_site_id.Rd | 12 ++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/R/fpr_tidy_assign_site_id.R b/R/fpr_tidy_assign_site_id.R index 38b3895..11613b5 100644 --- a/R/fpr_tidy_assign_site_id.R +++ b/R/fpr_tidy_assign_site_id.R @@ -1,8 +1,9 @@ #' Function to process site ID value from pscis_crossing_id and my_crossing_reference #' #' Intended for processing field data from digital form in which only one value should be provided. -#' It checks if the dataframe has both 'pscis_crossing_id' and 'my_crossing_reference' values, or none of them. -#' If any rows violate these rules, it returns an error that prints out a simplified dataframe with violating rows. +#' It checks to confirm the dataframe has one and only one of either a `pscis_crossing_id` or a `my_crossing_reference`. +#' It also uses [fpr_chk_dupes()] to issue a warning if there are duplicate values of `pscis_crossing_id`, +#' `my_crossing_reference` or `site_id` #' #' @param dat A dataframe to process. Default is NULL. #' @return A processed dataframe. @@ -21,7 +22,14 @@ #' date_time_start = Sys.time() + 0:3 #' ) #' +#' #' dat_warn_dupe <- tibble( +#' pscis_crossing_id = c(1, 3, NA, 4), +#' my_crossing_reference = c(NA, NA, 3, NA), +#' date_time_start = Sys.time() + 0:3 +#' ) +#' #' fpr_tidy_assign_site_id(dat_pass) +#' fpr_tidy_assign_site_id(dat_warn_dupe) #' } fpr_tidy_assign_site_id <- function(dat = NULL) { diff --git a/man/fpr_tidy_assign_site_id.Rd b/man/fpr_tidy_assign_site_id.Rd index 9841ed3..4ebb7ee 100644 --- a/man/fpr_tidy_assign_site_id.Rd +++ b/man/fpr_tidy_assign_site_id.Rd @@ -14,8 +14,9 @@ A processed dataframe. } \description{ Intended for processing field data from digital form in which only one value should be provided. -It checks if the dataframe has both 'pscis_crossing_id' and 'my_crossing_reference' values, or none of them. -If any rows violate these rules, it returns an error that prints out a simplified dataframe with violating rows. +It checks to confirm the dataframe has one and only one of either a `pscis_crossing_id` or a `my_crossing_reference`. +It also uses [fpr_chk_dupes()] to issue a warning if there are duplicate values of `pscis_crossing_id`, +`my_crossing_reference` or `site_id` } \examples{ \dontrun{ @@ -25,7 +26,14 @@ my_crossing_reference = c(NA, NA, 3, NA), date_time_start = Sys.time() + 0:3 ) +#' dat_warn_dupe <- tibble( +pscis_crossing_id = c(1, 3, NA, 4), +my_crossing_reference = c(NA, NA, 3, NA), +date_time_start = Sys.time() + 0:3 +) + fpr_tidy_assign_site_id(dat_pass) +fpr_tidy_assign_site_id(dat_warn_dupe) } } \concept{tidy}