value_validate

0th

Percentile

Tools for working with parameter values

Tools for working with parameter values

Usage
value_validate(object, values)

value_seq(object, n, original = TRUE)

value_sample(object, n, original = TRUE)

value_transform(object, values)

value_inverse(object, values)

value_set(object, values)

Arguments
object

An object with class quant_param.

values

A numeric vector or list (including Inf). Values cannot include unknown(). For value_validate, the units should be consistent with the parameter object's definition.

n

An integer for the (maximum) number of values to return. In some cases where a sequence is requested, the result might have less than n values. See Details.

original

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

Details

For sequences of integers, the code uses unique(floor(seq(min, max, length = n))) and this may generate an uneven set of values shorter than n. This also means that if n is larger than the range of the integers, a smaller set will be generated. For qualitative parameters, the first n values are returned.

If a single value sequence is requested, the default value is returned (if any). If not default is specified, the regular algorithm is used.

For quantitative parameters, any values contained in the object are sampled with replacement. Otherwise, a sequence of values between the range values is returned. It is possible that less than n values are returned.

For qualitative parameters, sampling is conducted with replacement. For qualitative values, a random uniform distribution is used.

Value

value_validate() throws an error or silently returns the values. value_transform and value_inverse return a vector of numeric values while value_seq and value_sample return a vector of values consistent with the type field of object.

Aliases
  • value_validate
  • value_seq
  • value_sample
  • value_transform
  • value_inverse
  • value_set
Examples
# NOT RUN {
library(dplyr)

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

# Is a specific value valid?
penalty
penalty %>% range_get()
value_validate(penalty, 17)

# get a sequence of values
Cp
Cp %>% value_seq(4)
Cp %>% value_seq(4, original = FALSE)

on_log_scale <- Cp %>% value_seq(4, original = FALSE)
nat_units <- value_inverse(Cp, on_log_scale)
nat_units
value_transform(Cp, nat_units)

# random values in the range
set.seed(3666)
Cp %>% value_sample(2)


# }
Documentation reproduced from package dials, version 0.0.2, License: GPL-2

Community examples

Looks like there are no examples yet.