Learn R Programming

rPref (version 0.1)

base_pref: Base preferences

Description

Base preferences are used to describe the different goals of a preference query.

Usage

low(expr)

high(expr)

true(expr)

Arguments

expr
Value which is the term for the current preference and should be minimized/maximized or, for boolean preferences, TRUE. The term expr can be just a single attribute an arbitrary expression, e.g., low(a+2*b+f(c)), w

Details

All base preferences are mathematically strict weak orders (irreflexive, transitive and negative transitive). The three fundamental base preferences are: [object Object],[object Object] Functions contained in expr are evaluated over the entire dataset, i.e., it is possible to use aggregate functions (min, mean, etc.). Note that all functions (and also variables not occuring in the dataset, where pref will be evaluated on) must be defined in the same environment (e.g. function scope) as the base preference.

See Also

See complex_pref how to compose complex preferences to retrieve e.g. the Skyline. See base_pref_macros for more base preferences.

Examples

Run this code
# Define a preference with a score value combining mpg and hp
p1 <- high(4*mpg + hp)
# Perform the preference selection
psel(mtcars, p1)

# Define a preference with a given function
f <- function(x, y) (abs(x-mean(x))/max(x) + abs(y-mean(y))/max(y))
p2 <- low(f(mpg, hp))
psel(mtcars, p2)

Run the code above in your browser using DataLab