Validates that a data.table is compatible with a given ParamSet.
Checks column presence, types, bounds, and uniqueness within the domain and
does type coercion if necessary.
Usage
assert_data_table_param_set(
dt,
param_set,
require_uniqueness = TRUE,
min_rows = 1L,
presence = "all",
allow_untyped = FALSE,
allow_extra = TRUE,
.param_set_name = "param_set",
.dt_name = "dt"
)Arguments
- dt
(
data.table)data.tableto validate.- param_set
(paradox::ParamSet)
ParamSetdescribing the space to validate against.- require_uniqueness
(
logical(1))
Whether to require uniqueness within the space. Default isTRUE.- min_rows
(
integer(1))
Minimum number of rows required indt. Default is1L.- presence
(
character(1))
Whether all parameters must be present as columns indt. Use"all"(default) to require all parameters, or"subset"to allow missing parameter columns and validate them as typedNAvalues.- allow_untyped
(
logical(1))
Whether to allowp_utyin theParamSet. Default isFALSE.p_utycolumns are not checked for type compatibility. Theircustom_checkis applied when present.- allow_extra
(
logical(1))
Whether columns outside theParamSetare allowed. Default isTRUE.- .param_set_name
(
character(1))
Name of theParamSetfor error messages. Default is"param_set".- .dt_name
(
character(1))
Name of thedata.tablefor error messages. Default is"dt".
Details
Extra columns are allowed and are passed through unchanged when
allow_extra = TRUE.
Missing parameter columns are rejected unless presence = "subset", in
which case they are validated as typed NA values on an internal copy.
When require_uniqueness is TRUE, tables with rows that are duplicated
within the space of the ParamSet are rejected, even if they differ by other columns.