convert_alternatives {DEXiR} | R Documentation |
convert_alternatives
Description
Converts a data.frame
of alternatives' data to another data.frame
. The conversion
generally involves: aggregating DEXi values originally represented by sets or distributions,
scaling aggregated values to a given interval and/or reversing values assigned to "descending"
DexiScales.
Usage
convert_alternatives(
model,
alternatives = NULL,
interpret = c("set", "distribution", "none"),
aggregate = min,
omin = 0,
omax = 1,
map_values = TRUE,
reverse_descending = TRUE,
verbatim = "name",
skip = NULL,
continuous = convert_data_continuous,
discrete = convert_data_discrete
)
Arguments
model |
A DexiModel object. Required. |
alternatives |
A |
interpret |
Values corresponding to continuous attributes are not converted nor affected by these settings. |
aggregate |
A function accepting the interpreted DEXi value (see |
omin |
|
omax |
|
map_values |
|
reverse_descending |
|
verbatim |
|
skip |
|
continuous |
A function converting a data column that corresponds to a continuous attribute.
Default: |
discrete |
A function converting a data column that corresponds to a discrete attribute.
Default: |
Details
The rationale for convert_alternatives()
is that data frames representing alternatives,
particularly those produced by evaluate()
, generally contain DEXi values of various
and mixed data types, such as numbers and numeric vectors (sets and distributions).
As such, this data is difficult to work with in R,
as most R functions expect simpler and more uniform data structures.
convert_alternatives()
produces data frames that are more suitable for standard R data analysis
and graph drawing. However, as the conversion generally involves aggregation and mapping
of DEXi values, it may distort or lose information along the way.
Value
A converted data.frame
.
See Also
convert_data_continuous()
, convert_data_discrete()
, scale_alternatives()
,
DEXiR-package notes on values in DEXi models.
Examples
# Load "Car.dxi"
CarDxi <- system.file("extdata", "Car.dxi", package = "DEXiR")
Car <- read_dexi(CarDxi)
# Map Car$alternatives' values to the [0, 1] interval.
convert_alternatives(Car)
# name CAR.1 PRICE BUY.PRICE MAINT.PRICE TECH.CHAR. COMFORT X.PERS X.DOORS LUGGAGE SAFETY
# 1 Car1 1.0000000 1.0 0.5 1.0 1.0000000 1 1 0.6666667 1 1.0
# 2 Car2 0.6666667 0.5 0.5 0.5 0.6666667 1 1 0.6666667 1 0.5