Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

range_validate

Tools for working with parameter ranges


Description

Setters, getters, and validators for parameter ranges.

Usage

range_validate(object, range, ukn_ok = TRUE)

range_get(object, original = TRUE)

range_set(object, range)

Arguments

object

An object with class quant_param.

range

A two-element numeric vector or list (including Inf). Values can include unknown() when ukn_ok = TRUE.

ukn_ok

A single logical for whether unknown() is an acceptable value.

original

A single logical. Should the range values be in the natural units (TRUE) or in the transformed space (FALSE, if applicable)?

Value

range_validate() returns the new range if it passes the validation process (and throws an error otherwise).

range_get() returns the current range of the object.

range_set() returns an updated version of the parameter object with a new range.

Examples

library(dplyr)

my_lambda <- penalty() %>%
  value_set(-4:-1)

try(
  range_validate(my_lambda, c(-10, NA)), silent = TRUE
) %>%
  print()

range_get(my_lambda)

my_lambda %>%
  range_set(c(-10, 2)) %>%
  range_get()

dials

Tools for Creating Tuning Parameter Values

v0.0.10
MIT + file LICENSE
Authors
Max Kuhn [aut], Hannah Frick [aut, cre], RStudio [cph]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.