aveWithArgs: the ave() function but with arguments passed to FUN
Description
A function is applied to subsets of x where each subset consist of those observations with the same groupings in y
Usage
aveWithArgs(x, y, FUN = mean, ...)
Value
A numeric vector of the same length as x where an each element contains the output from FUN after FUN was applied on the corresponding subgroup for that element (repeated if necessary within a subgroup).
Arguments
x
a vector to apply FUN to
y
a vector or list of vectors of grouping variables all of the same length as x
FUN
function to apply for each factor level combination.