Arguments
Factor
a vector from which a factor will be created, or a
factor (possibly ordered) whose levels will be reordered
X
a vector of the same length as Factor
, whose subset
of values for each unique level of Factor
determines the
eventual order of that level
Function
a function whose first argument is a vector and
returns a scalar, to be applied to each subset of X
determined by the levels of Factor
...
extra arguments supplied to Function
order
logical, whether return value will be an ordered factor
rather than a factor