A helper function for preparing alternatives' data for charts that involve multiple
attributes (such as plotalt_parallel()
) and plotalt_radar()
).
scale_alternatives()
carries out three main operations:
Aggregates DEXi values, represented by sets and distributions,
into single numeric values, using one of the aggregate
operators:
"minmax"
, "min"
, "max"
or "mean"
,
scales the aggregated values to the [0,1]
interval so that they can be
drawn uniformly on multiple chart axes,
optionally "shifts" the values by a small amount to avoid overlapping chart lines.
scale_alternatives(
model,
alternatives = NULL,
attids = NULL,
aggregate = c("minmax", "min", "max", "mean", "none"),
name = "name",
shift = 0.01
)
A list containing the elements:
data
A data frame containing the aggregated/scaled/shifted numeric values.
nalt
The number of alternatives. Notice that with aggregate = "minmax"
,
data
contains twice as many rows.
groups
A numeric vector mapping data
rows to alternatives
' indices.
altnames
Names of alternatives.
A DexiModel object. Required.
A data.frame
of alternatives (normally an output of evaluate()
) or
indices to model$alternatives
. The default value NULL
selects the whole model$alternatives
.
character()
. A character vector of DexiAttribute IDs to be included in the result.
Default: all model
attributes.
Determines how to aggregate DEXi values that are represented/interpreted
as sets in alternatives
:
"min"
Uses the function min()
to take the minimal set element.
"max"
Uses the function max()
to take the maximal set element.
"mean"
Uses the function mean()
to take the average set value.
"minmax"
(default)Takes both "min"
and "max"
, so that each alternative
appears in the result twice.
"none"
No aggregation.
Any distributions that appear in alternatives
are interpreted as sets prior to aggregation.
The default operator "minmax"
is suitable particularly for alternatives containing non-single-values
(sets and/or distributions). For alternatives containing only single numeric values, any of the
other three operators is preferred.
character(1)
, The name of the column in alternatives
that contains
alternatives' names. Default: "name"
.
numeric(1)
. Used to "shift" numerical values by a small amount to avoid overlapping
lines in charts. Default: 0.01
.
plotalt_parallel()
), plotalt_radar()
)