Skip to content

Commit

Permalink
update to cli_warn
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanThoma committed Sep 30, 2024
1 parent e846b67 commit 5ab8252
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
7 changes: 3 additions & 4 deletions R/derive_vars_cat.R
Original file line number Diff line number Diff line change
Expand Up @@ -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?"
))
}

Expand Down
4 changes: 1 addition & 3 deletions tests/testthat/_snaps/derive_vars_cat.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down

0 comments on commit 5ab8252

Please sign in to comment.