Learn R Programming

DEXiR (version 1.0.2)

bounded_scale_value: bounded_scale_value

Description

bounded_scale_value is a wrapper around scale_value() that makes sure that the resulting values lie within the bounds set up by the scale.

Usage

bounded_scale_value(value, scale)

Value

For continuous scales, value is returned "as is". For discrete scales, all elements of value that lie outside of scale$full_range() are removed. If this results in an empty value set or distribution, NULL is returned.

Arguments

value

Any DEXi value, including value sets and distributions.

scale

A DexiScale or derived object.

See Also

scale_value()

Examples

Run this code
scl <- DexiDiscreteScale(values = c("low", "med", "high"))
bounded_scale_value(NA, scl)                               # NA
bounded_scale_value(1, scl)                                # 1
bounded_scale_value(4, scl)                                # NULL
bounded_scale_value(c(0, 1, 3,  4, 5), scl)                # c(1, 3)
bounded_scale_value(distribution(0.1, 0.2, 0.3, 0.4), scl) # distribution(0.1, 0.2, 0.3)

Run the code above in your browser using DataLab