View source: R/aggregatingMeta.R
aggregatingFunction1 | R Documentation |
aggregatinFuntion1
creates statistical summaries of one numerical vector that are formula aware.
aggregatingFunction1(
fun,
output.multiple = FALSE,
envir = parent.frame(),
na.rm = getOption("na.rm", FALSE),
style = c("formula1st", "formula", "flexible")
)
fun |
a function that takes a numeric vector and computes a summary statistic, returning a numeric vector. |
output.multiple |
a boolean indicating whether |
envir |
an environment in which evaluation takes place. |
na.rm |
the default value for na.rm in the resulting function. |
style |
one of |
The logic of the resulting function is this: 1) If the first argument is a formula,
use that formula and data
to create the necessary call(s) to fun
; (2) Else simply
pass everything to fun
for evaluation.
a function that generalizes fun
to handle a formula/data frame interface.
Earlier versions of this function supported a "bare name + data frame" interface. This functionality has been removed since it was (a) ambiguous in some cases, (b) unnecessary, and (c) difficult to maintain.
if (require(mosaicData)) {
foo <- aggregatingFunction1(base::mean)
foo( ~ length, data = KidsFeet)
base::mean(KidsFeet$length)
foo(length ~ sex, data = KidsFeet)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.