From 5ab8252e3b05236db4bbeb6c230e0d5c0f78ee09 Mon Sep 17 00:00:00 2001 From: Stefan Pascal Thoma Date: Mon, 30 Sep 2024 09:35:51 +0000 Subject: [PATCH] update to cli_warn --- R/derive_vars_cat.R | 7 +++---- tests/testthat/_snaps/derive_vars_cat.md | 4 +--- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/R/derive_vars_cat.R b/R/derive_vars_cat.R index fd9bc589ea..fd29532e4c 100644 --- a/R/derive_vars_cat.R +++ b/R/derive_vars_cat.R @@ -217,10 +217,9 @@ derive_vars_cat <- function(dataset, # warn if new variables already exist if (any(new_col_names %in% names(dataset))) { - warning(paste("Column(s) in `definition` already exist in `dataset`.", - "Did you forget to specify `by_vars`,", - "or are you rerunning your code?", - sep = "\n" + cli_warn(paste("Column(s) in {.arg definition} already exist in {.arg dataset}.", + "Did you forget to specify {.arg by_vars},", + "or are you rerunning your code?" )) } diff --git a/tests/testthat/_snaps/derive_vars_cat.md b/tests/testthat/_snaps/derive_vars_cat.md index b5b2dc2df7..68282aeaed 100644 --- a/tests/testthat/_snaps/derive_vars_cat.md +++ b/tests/testthat/_snaps/derive_vars_cat.md @@ -1,8 +1,6 @@ # derive_vars_cat Test 3: Forgot to specify by_vars - Column(s) in `definition` already exist in `dataset`. - Did you forget to specify `by_vars`, - or are you rerunning your code? + Column(s) in `definition` already exist in `dataset`. Did you forget to specify `by_vars`, or are you rerunning your code? # derive_vars_cat Test 13: definition has wrong shape