DexiDiscreteScale-class {DEXiR} | R Documentation |
DexiDiscreteScale
Description
DexiDiscreteScale
is a RC class, derived from DexiScale,
representing qualitative (symbolic, discrete, verbal) value scales in R. Such scales are
typical for DEXi models and are the only scale type supported by the DEXi software.
DEXiWin software supports both continuous and discrete scales.
Details
An attribute associated with a discrete scale can take values from a finite (and usually small)
set of string values contained in the character vector values
. Additionally, each of these values is
associated with one of the qualities "bad"
, "none"
or "good"
.
The latter are contained in the character vector quality
,
which is of the same length as values
.
Fields
values
character. Vector of qualitative scale values. Example:
scale$values <- c("low", "medium", "high")
.nvals
integer. Equal to
length(values)
.quality
character. Vector of qualities, corresponding to
values
. Should be the of the same length asvalues
. Example:scale$quality <- c("bad", "none", "good")
.descriptions
character. A vector of textual descriptions of the corresponding
values
. Should be of the same length asvalues
.
Methods
count()
Return the number of scale elements. Equal to
NA
forDexiScale
,0
forDexiContinuousScale
, and equal tonvals >= 0
forDexiDiscreteScale
.equal(scl)
Check if this scale is equal to scale
scl
. Needed for attribute linking.full_range()
Return the vector that represents the full range of values on this scale. Equal to
NA
forDexiScale
andDexiContinuousScale
, and1 : scale$nvals
forDexiDiscreteScale
.initialize(order = EnumOrder, ...)
Initialize a
DexiScale
object.is_discrete()
Logical: Is this scale discrete?
to_string()
Return a string representation of this scale for printing.
value_index(value)
Find the index of
value
(character(1)) on this scale. Equal toNA
forDexiScale
andDexiContinuousScale
. WithDexiDiscreteScale
objects, it returns a numeric index orNA
ofvalue
inscale$values
.value_quality(value)
Return the quality (preferential class) of
value
on this scale: one of the strings"bad"
,"none"
or"good"
. Always"none"
forDexiScale
and scales withorder = "none"
.verify()
Check the correctnes of this scale object and its fields. Result:
error()
orTRUE
.
Examples
# Load "Car.dxi"
CarDxi <- system.file("extdata", "Car.dxi", package = "DEXiR")
Car <- read_dexi(CarDxi)
# For example, consider the scale of attribute PRICE
scl <- Car$attrib("PRICE")$scale
# Print fields and basic properties of scl
scl$verify()
scl$values
scl$quality
scl$descriptions
scl$nvals
scl$count()
scl$is_discrete()
scl$is_continuous()
scl$to_string()
scl$full_range()
# Find value indices
scl$value_index("medium")
scl$value_index("med")
# Is scl equal to the scale of BUY.PRICE?
scl$equal(Car$attrib("PRICE")$scale)