Learn R Programming

DEXiR (version 1.0.2)

convert_data_continuous: convert_data_continuous

Description

A helper function for converting individual columns of alternatives' data. It is assumed that data contains numeric data corresponding to a continuous DexiAttribute. During conversion, values are optionally converted from some interval to another, using lin_map(), and/or reversed using reverse_value() for scales whose $order = "descending".

Usage

convert_data_continuous(
  data,
  scale,
  imin = NULL,
  imax = NULL,
  omin = 0,
  omax = 1,
  map_values = TRUE,
  reverse_descending = TRUE
)

Value

numeric(). Vector of converted values.

Arguments

data

A vector containing floating point numbers. Typically a data.frame column of DEXi alternatives' data.

scale

A DexiContinuousScale object or a continuous DexiAttribute object.

imin

Lower input bound. Default: determined as min(data).

imax

Upper input bound. Default: determined as max(data).

omin

Lower output bound for lin_map() value scaling.

omax

Upper output bound for lin_map() value scaling.

map_values

logical(1). Whether or not to perform value scaling using lin_map().

reverse_descending

logical(1). Whether or not to reverse values of a "descending" scale.

See Also

lin_map(), reverse_value()

Examples

Run this code
scl <- DexiContinuousScale()
convert_data_continuous(c(1, 2, 5), scl) # c(0.0, 0.25, 1.00)
convert_data_continuous(c(1, 2, 5), scl, imin = 0, imax = 10, omin = 0, omax = 100)
# c(10, 20, 50)

Run the code above in your browser using DataLab