1
0
mirror of https://github.com/msberends/AMR.git synced 2026-03-19 23:02:26 +01:00

Replace bare backticks with cli inline markup across all messaging calls

- {.arg} for argument names in stop_/warning_/message_ calls
- {.cls} after "of class" text in format_class() and elsewhere
- {.fun} for function names (replaces `fn()` pattern)
- {.pkg} for tidyverse package names (dplyr, ggplot2)
- {.code} for code literals (TRUE, FALSE, expressions)
- Rewrite print.ab: use cli named-vector with * bullets and code
  highlighting when cli >= 3.0.0; keep plain-text fallback otherwise
- Fix typo in as.sir(): "of must be" -> "or must be"
- switch sir.R verbose notes from message() to message_()

https://claude.ai/code/session_01XHWLohiSTdZvCutwD7ag2b
This commit is contained in:
Claude
2026-03-19 08:35:26 +00:00
parent 5173009625
commit 1dabd4df3d
27 changed files with 107 additions and 92 deletions

View File

@@ -138,7 +138,7 @@ resistance_predict <- function(x,
extra_msg = paste0("Use the tidymodels framework instead, for which we have written a basic and short introduction on our website: ", font_url("https://amr-for-r.org/articles/AMR_with_tidymodels.html", txt = font_bold("AMR with tidymodels")))
)
stop_if(is.null(model), 'choose a regression model with the `model` argument, e.g. resistance_predict(..., model = "binomial")')
stop_if(is.null(model), 'choose a regression model with the {.arg model} argument, e.g. {.code resistance_predict(..., model = "binomial")}')
x.bak <- x
x <- as.data.frame(x, stringsAsFactors = FALSE)
@@ -146,7 +146,7 @@ resistance_predict <- function(x,
# -- date
if (is.null(col_date)) {
col_date <- search_type_in_df(x = x, type = "date")
stop_if(is.null(col_date), "`col_date` must be set")
stop_if(is.null(col_date), "{.arg col_date} must be set")
}
stop_ifnot(
col_date %in% colnames(x),
@@ -357,7 +357,7 @@ ggplot_sir_predict <- function(x,
meet_criteria(ribbon, allow_class = "logical", has_length = 1)
stop_ifnot_installed("ggplot2")
stop_ifnot(inherits(x, "resistance_predict"), "`x` must be a resistance prediction model created with resistance_predict()")
stop_ifnot(inherits(x, "resistance_predict"), "{.arg x} must be a resistance prediction model created with {.fun resistance_predict}")
if (attributes(x)$I_as_S == TRUE) {
ylab <- "%R"