# 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