We were trying to add custom checking functions using import-standalone_types_check.R in https://github.com/tidymodels/dials/. And it would be nice if there was a way to add to the ways obj_type_friendly() works without having to modify a file that says This document is read only.
In the below example, it would be nice if we could make it say parameter set instead of the more verbose <parameters/tbl_df/tbl/data.frame>.
check_param <- function(x,
...,
allow_na = FALSE,
allow_null = FALSE,
arg = caller_arg(x),
call = caller_env()) {
if (!missing(x) && inherits(x, "param")) {
return(invisible(NULL))
}
stop_input_type(
x,
c("a single parameter object"),
...,
allow_na = allow_na,
allow_null = allow_null,
arg = arg,
call = call
)
}
library(dials)
#> Loading required package: scales
param <- mtry()
check_param(param)
parameter_set <- parameters(param)
check_param(parameter_set)
#> ERROR:
#> ! `parameter_set` must be a single parameter object, not a <parameters/tbl_df/tbl/data.frame> object.
We were trying to add custom checking functions using
import-standalone_types_check.R
in https://github.com/tidymodels/dials/. And it would be nice if there was a way to add to the waysobj_type_friendly()
works without having to modify a file that saysThis document is read only.
In the below example, it would be nice if we could make it say
parameter set
instead of the more verbose<parameters/tbl_df/tbl/data.frame>
.