range_validate | R Documentation |
Setters, getters, and validators for parameter ranges.
range_validate(object, range, ukn_ok = TRUE, ..., call = caller_env())
range_get(object, original = TRUE)
range_set(object, range)
object |
An object with class |
range |
A two-element numeric vector or list (including |
ukn_ok |
A single logical for whether |
... |
These dots are for future extensions and must be empty. |
call |
The call passed on to |
original |
A single logical. Should the range values be in the natural
units ( |
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.
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()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.