Learn R Programming

DEXiR (version 1.0.2)

select_quality: select_quality

Description

Select from alt only those attributes whose values have the given quality. Used primarily in selective_explanation().

Usage

select_quality(model, alt, quality)

Value

alt containing only values that have the requested quality.

Arguments

model

A DexiModel object.

alt

data.frame. A single DEXi alternative.

quality

Requested EnumQuality: "bad", "good" or "none".

See Also

value_qualities(), selective_explanation()

Examples

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

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)
alts <- select_quality(Car, alte, "bad")
names(alts)
# c("CAR", "PRICE", "MAINT.PRICE", "TECH.CHAR.", "SAFETY")
alts <- select_quality(Car, alte, "none")
names(alts)
# c("MAINT.PRICE", "X.DOORS", "LUGGAGE")
alts <- select_quality(Car, alte, "good")
names(alts)
# c("CAR", "PRICE", "BUY.PRICE", "MAINT.PRICE", "TECH.CHAR.", "COMFORT", "X.PERS", "SAFETY")

Run the code above in your browser using DataLab