From 8a35aca775ddd1bd3b6c20b70e85521ae4893022 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 21 Jan 2025 12:17:17 +0100 Subject: [PATCH] fix --- R/get_datagrid.R | 2 +- tests/testthat/test-get_datagrid.R | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/R/get_datagrid.R b/R/get_datagrid.R index 40e23eba3..dc02eb94d 100644 --- a/R/get_datagrid.R +++ b/R/get_datagrid.R @@ -841,7 +841,7 @@ get_datagrid.comparisons <- get_datagrid.slopes } else { format_error( paste0( - "The `by` argument (", by, ") should either indicate the minimum and the maximum, or one of the following options: ", # nolint + "The `by` argument (", by, ") should either indicate a valid factor level, the minimum and the maximum value of a vector, or one of the following options: ", # nolint toString(shortcuts), "." ) diff --git a/tests/testthat/test-get_datagrid.R b/tests/testthat/test-get_datagrid.R index 51d29de6d..9f7366c2b 100644 --- a/tests/testthat/test-get_datagrid.R +++ b/tests/testthat/test-get_datagrid.R @@ -57,6 +57,11 @@ test_that("get_datagrid - terciles, quartiles, mean-sd", { dg <- insight::get_datagrid(m, "Species=[setosa]") expect_identical(dim(dg), c(1L, 3L)) + expect_error( + insight::get_datagrid(m, "Species=[petosa]"), + regex = "should either indicate" + ) + skip_if_not_installed("ggeffects") data(efc, package = "ggeffects") efc$c161sex <- datawizard::to_factor(efc$c161sex)