| general_pref | R Documentation |
Collection of some useful functions which are applicable to all preference objects.
empty()
is.empty_pref(x)
## S4 method for signature 'preference'
length(x)
is.preference(x)
## S4 method for signature 'preference'
as.expression(x, ...)
## S4 method for signature 'preference'
assoc.df(x)
## S4 replacement method for signature 'preference'
assoc.df(x) <- value
x |
A preference, or, for |
... |
Optional arguments passed to |
value |
A data frame or data frame extension (e.g., a tibble) to associate with a preference object. |
The empty preference empty() is a neutral element for the complex preference compositions {*, &, +}.
It holds that empty() * p and empty() & p is equal to p for all preferences p.
The function length(p) returns the term length of the preference term p
which is defined as the number of base preferences
in a complex preference term. The empty preference empty() has length 0,
and all base preferences have length 1.
With as.expression(p) for a preference p the call to the preference is constructed.
This means, eval(as.expression(p)) returns the preference p, evaluated in the current environment.
The function is.empty_pref returns TRUE if x is the empty preference object
empty() and FALSE otherwise.
With assoc.df the associated data frame of a preference can be retrieved or set.
Setting the associated data frame means that a partial evaluation based on this data frame is done.
See show.pref for details on partial evaluation of preferences.
Next, the preference is linked to that data frame, such that peval(p) can be used instead of psel(df, p).
It returns NULL if no data frame is associated.
Use set.assoc.df(NULL) to delete an associated data frame.
See base_pref for the construction of base preferences,
and complex_pref for the construction of complex preferences.
See show.pref for string output and partial evaluation of preference terms.
# Same as low(a) * low(b).
p <- low(a) * low(b) * empty()
# Returns 2, as empty() does not count.
length(p)
# The preference expression (without empty()).
as.expression(p)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.