expand_value_to_points: expand_value_to_points

View source: R/DexiValues.R

expand_value_to_pointsR Documentation

expand_value_to_points

Description

Expand a DEXi value to a sequence of individual elements (points). Particularly aimed for graphic functions that display DEXi values with dots of different sizes and colors.

Usage

expand_value_to_points(value, scale, colors = c("red", "black", "green"))

Arguments

value

A DEXi value: a single value (integer or float), a set (integer vector) or a distribution.

scale

A DexiScale object.

colors

numeric(3) representing colors to display "bad", "neutral" and "good" values, respectively.

Value

A data.frame consisting of:

points

numeric(). value expanded to a vector of ordinal values.

sizes

numeric(). Numeric values assigned to each corresponding ordinal values. Normally 1.0 for set elements and in the ⁠(0,1]⁠ interval for distribution membership values.

colors

Colors assigned to corresponding value qualities.

Examples

scl <- DexiDiscreteScale(values = c("L", "M", "H"))

expand_value_to_points(c(1, 3), scl)
# points sizes colors
# 1      1     1    red
# 2      3     1  green

expand_value_to_points(distribution(0.1, 0, 0.9), scl)
# points sizes colors
# 1      1   0.1    red
# 2      3   0.9  green


DEXiR documentation built on Sept. 30, 2024, 9:39 a.m.