Learn R Programming

DEXiR (version 1.0.2)

compare_two_alternatives: compare_two_alternatives

Description

Compare alternatives alt1 and alt2 with respect to attributes.

Usage

compare_two_alternatives(alt1, alt2, attributes, deep = TRUE)

Value

numeric(length(attributes)). Each element represents the outcome of comparison w.r.t. the corresponding attribute. Possible outcomes:

0

Values are equal.

-1

alt1's value is worse than alt2's.

+1

alt1's value is better than alt2's.

NA

Values are incomparable.

When deep = TRUE, the so-called deep comparison is performed: when the compared attribute's values are equal, subordinate attributes are checked for differences, possibly returning -0.5 (indicating the weak preference relation "<=") or +0.5 (indicating the weak preference relation ">=").

Arguments

alt1

data.frame. First alternative.

alt2

data.frame. Second alternative.

attributes

Vector of DexiAttribute objects.

deep

logical(1). When TRUE and compared values are equal, input attributes are additionally investigated for possible preferential differences.

See Also

compare_values_on_scale()

Examples

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

compare_two_alternatives(Car$alternatives[1,], Car$alternatives[2,], Car$attributes)
# c(NA, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1)

Run the code above in your browser using DataLab