Fix issues #1, #3, #5: misc improvements
R-CMD-check / R CMD check (pull_request) Failing after 4m43s

- #5: Unwrap _brand.yml for Quarto 1.9+ compatibility (remove top-level
  brand: wrapper so meta/logo/color/typography are at the top level)
- #1: Add quiet parameter to na_sum() to suppress warnings in loops/pipelines
- #3: Add beep() function for CLI beep, desktop notifications, and webhook
  alerts (supports type=beep|notify|webhook|all)
This commit is contained in:
2026-06-03 19:01:30 +00:00
parent 136c53643c
commit 2f1cdcde52
6 changed files with 246 additions and 61 deletions
+8 -2
View File
@@ -149,6 +149,9 @@ race_short_names <- function(x) {
#' Sum a numeric that contains missing values and ignore missing values
#'
#' @param x a numeric vector
#' @param quiet Logical. If `TRUE` (default `FALSE`), suppress the warning
#' message. Useful when calling `na_sum()` inside a loop or `dplyr` pipeline
#' where the message would be emitted repeatedly.
#'
#' @return the sum, ignoring any missing values
#' @export
@@ -156,9 +159,12 @@ race_short_names <- function(x) {
#' @examples
#' x <- c(2, NA, 4, 9)
#' na_sum(x) # 15
na_sum <- function(x) {
#' na_sum(x, quiet = TRUE) # 15 (no message)
na_sum <- function(x, quiet = FALSE) {
stopifnot(is.numeric(x))
message("Taking a sum with missing values equal to 0, be careful!")
if (!quiet) {
message("Taking a sum with missing values equal to 0, be careful!")
}
x <- na_zero(x)
return(sum(x))
}