You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have .default() methods for several other generics, but not for the grid functions. (The one for encode_unit() needs fixing: #430.)
library(dials)
#> Loading required package: scales# no default method
grid_regular("foo")
#> Error in `UseMethod()`:#> ! no applicable method for 'grid_regular' applied to an object of class "character"# with default method
parameters("foo")
#> Error in `parameters()`:#> ! <parameters> objects cannot be created from a string.
finalize("foo")
#> Error in `finalize()`:#> ! Cannot finalize a string.
encode_unit("foo")
#> Error in `encode_unit()`:#> ! argument "direction" is missing, with no default
We might change what happens if x is missing (see #428) but until then, we need to catch that case. Otherwise {.obj_type_friendly {x}} fails.
#' @export
#' @rdname grid_regular
grid_regular.default <- function(
x,
...,
levels = 3,
original = TRUE,
filter = NULL
) {
if (missing(x)) {
cli::cli_abort("At least one parameter object is required.")
}
cli::cli_abort(
"{.arg x} must be a {.cls param} object, list, or {.cls parameters}, not
{.obj_type_friendly {x}}."
)
}
Activity
hfrick commentedon Apr 7, 2026
Fix
We might change what happens if
xis missing (see #428) but until then, we need to catch that case. Otherwise{.obj_type_friendly {x}}fails.hfrick commentedon Apr 7, 2026
Add
to
test_that("grid_random() errors with non-param inputs", {...})