Skip to content

Commit 3f57cd1

Browse files
committed
move away form stop()
1 parent bd3d8f8 commit 3f57cd1

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

DESCRIPTION

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ BugReports: https://github.com/tidymodels/modeldb/issues
1212
Depends:
1313
R (>= 3.61)
1414
Imports:
15+
cli,
1516
dplyr (>= 0.7),
1617
ggplot2,
1718
progress,
@@ -32,7 +33,7 @@ Suggests:
3233
VignetteBuilder:
3334
knitr
3435
Config/Needs/website: tidyverse/tidytemplate
36+
Config/testthat/edition: 3
3537
Encoding: UTF-8
36-
RoxygenNote: 7.2.3
3738
Roxygen: list(markdown = TRUE)
38-
Config/testthat/edition: 3
39+
RoxygenNote: 7.2.3

R/lm.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ mlr <- function(df, ..., y_var, sample_size = NULL, auto_count = FALSE) {
122122
if (auto_count) {
123123
sample_size <- pull(tally(df))
124124
} else {
125-
stop("No sample size provided, and auto_count is set to FALSE")
125+
cli::cli_abort("No sample size provided, and auto_count is set to FALSE")
126126
}
127127
}
128128

R/model_prep.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@ add_dummy_variables <- function(df, x, values = c(),
2727
auto_values = FALSE, remove_original = TRUE) {
2828
x <- enquo(x)
2929
var_found <- as_label(x) %in% tbl_vars(df)
30-
if (!var_found) stop("Variable not found")
30+
if (!var_found) cli::cli_abort("Variable not found")
3131
if (length(values) == 0) {
3232
if (auto_values == TRUE) {
3333
values <- group_by(df, !!x)
3434
values <- summarise(values)
3535
values <- pull(values)
3636
} else {
37-
stop("No values provided and auto_values is set to FALSE")
37+
cli::cli_abort("No values provided and auto_values is set to FALSE")
3838
}
3939
}
4040
vals <- map(values, ~ expr(ifelse(!!x == !!.x, 1, 0)))

0 commit comments

Comments
 (0)