dials (version 0.0.2)

new_quant_param: Tools for creating new parameter objects

Description

These functions are used to construct new parameter objects.

Usage

new_quant_param(type = c("double", "integer"), range, inclusive,
  default = unknown(), trans = NULL, values = NULL, label = NULL,
  finalize = NULL)

new_qual_param(type = c("character", "logical"), values, default = unknown(), label = NULL, finalize = NULL)

Arguments

type

A single character value. For quantitative parameters, valid choices are "double" and "integer" while for qualitative factors they are "character" and "logical".

range

A two-element list of vector with the lowest or largest possible values, respectively. If these cannot be set when the parameter is defined, the unknown() function can be used. If a transformation is specified, these values should be in the transformed units.

inclusive

A two-element logical vector for whether the the range values should be inclusive or exclusive.

default

A single value the same class as type for the default parameter value. unknown() can also be used here.

trans

A trans object from the scales package, such as scales::log10_trans() or scales::reciprocal_trans().

values

A vector of possible values that is required when type is "character" or "logical" but optional otherwise.

label

An optional named character string that can be used for printing and plotting. The named should reflect the object name (e.g. "mtry", "neighbors", etc.)

finalize

A function that can be used to set the data-specific values of a parameter (such as the range).

Value

An object of class "param" with the primary class being either "quant_param" or "qual_param". The range element of the object is always converted to a list with elements "lower" and "upper". '

Examples

Run this code
# NOT RUN {
num_subgroups <-
  new_quant_param(
    type = "integer",
    range = c(1L, 20L),
    inclusive = c(TRUE, TRUE),
    trans = NULL,
    label = c(num_subgroups = "# Subgroups"),
    finalize = NULL
  )
# }

Run the code above in your browser using DataCamp Workspace