Learn R Programming

DEXiR (version 1.0.2)

selective_explanation: selective_explanation

Description

Selective Explanation: Displays subtrees of alternatives' values in which values are particularly weak (value quality is "bad") and particularly strong (value quality is "good").

Usage

selective_explanation(
  model,
  alternatives = NULL,
  print = TRUE,
  as_character = FALSE,
  round = NULL,
  id = NULL,
  evaluate = FALSE,
  ...
)

Value

A list of lists: For each alternative contains a list of two data.frames, corresponding to "bad" and "good" qualities, respectively. May be pretty-printed using print_selective_explanation().

Arguments

model

A DexiModel object. Required.

alternatives

A data.frame of alternatives or indices to model$alternatives. The default value NULL selects model$alternatives.

print

logical(1). When TRUE, pretty print (add headings and left justify) the results, using print_selective_explanation().

as_character

logical(1). Whether to represent alternative values numerically (FALSE) or using text (TRUE).

round

An integer number, argument to value_text().

id

character(1). Determines the contents of the first or first two columns of the resulting data.frames:

"id"

Attribute IDs.

"structure"

Attribute $structure() + $name.

anything else

Equivalent to both "id" and "structure".

evaluate

logical(1). Whether or not to evaluate alternatives beforehand.

...

Optional parameters for evaluate().

See Also

value_qualities(), value_text(), print_selective_explanation(), evaluate()

Examples

Run this code
# Load "Car.dxi"
CarDxi <- system.file("extdata", "Car.dxi", package = "DEXiR")
Car <- read_dexi(CarDxi)

# Print selective explanation of two Car$alternatives.
selective_explanation(Car)

alt <- Car$alternative("MyCar",
       BUY.PRICE="low", MAINT.PRICE="*", X.PERS="more", X.DOORS="4", LUGGAGE=2, SAFETY=c(1, 3))
alte <- Car$evaluate(alt)

# Print selective explanation of `alte`.
selective_explanation(Car, alte)

# Print selective explanation of both `alt` and `alte`.
selective_explanation(Car, rbind.data.frame(alt, alte))

Run the code above in your browser using DataLab