In addition to the fundamental base preferences, rPref offers some macros to define preferences where a given interval or point is preferred.
Usage
around(expr, center)
between(expr, left, right)
pos(expr, pos_value)
layered(expr, ...)
Arguments
expr
A numerical expression (for around and between) or an arbitrary expression (for pos and layered).
The objective are tuples where expr evaluates to a value in the preferred interval, layer, e
center
Preferred value for around.
left
Lower limit of the preferred interval for between.
right
Upper limit of the preferred interval for between.
pos_value
A vector containing the preferred values for a pos preference.
Has to be of the same type (numeric, logical, character, ...) as expr.
...
Layers (sets) for a layered preference. Each variable corresponds to one layer
and the first set characterizes the most preferred values.
# Search for cars where mpg is near to 25psel(mtcars, around(mpg, 25))
# cyl = 2 and cyl = 4 are equally good, cyl = 6 is worsepsel(mtcars, layered(cyl, c(2, 4), 6))