Description Usage Arguments Details Examples
Splits the data into subsets, computes summary statistics for each, and returns the result in a convenient form.
1 2 3 |
formula |
a two-sided formula: the lhs identifies the variable(s) that are the first argument of FUN (if there is more than one as in |
data |
a data frame. |
FUN |
a function. |
... |
additional arguments to the function |
subset |
a condition to subset the data frame. |
na.action |
determines whether to omit or include NAs in the grouping factors. Use |
xapply
works like aggregate
except that the result is returned as a vector in a data frame with the levels of the by
variable
replicated according to the length of the result.
The intention in writing xapply
was to facilitate the creation of 'prediction data frames' extending expand.grid
so that the values of
a variable can easily depend on the value of a factor. For example, predicting weight from height it might be desired to have a range of heights for each
sex that is consistent with the conditional distribution.
Suppose a data frame hw
contains variables Sex, height and weight. Instead of
1 2 3 4 |
we can have:
1 2 3 4 5 |
1 2 3 4 5 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.