Learn R Programming

mosaic (version 0.9-0)

aggregatingFunction1: 1-ary Aggregating functions

Description

aggregatinFuntion1 creates statistical summaries of one numerical vector that are formula aware.

Usage

aggregatingFunction1(fun, input.multiple = FALSE, output.multiple = FALSE,
  envir = parent.frame(), na.rm = getOption("na.rm", FALSE))

Arguments

fun
a function that takes a numeric vector and computes a summary statistic, returning a numeric vector of length 1.
output.multiple
a boolean indicating whether ..fun.. returns multiple values
input.multiple
a boolean indicating whether ..fun.. can accept 2 vectors (e.g., var)
envir
an environment in which evaluation takes place.
na.rm
the default value for na.rm in the resulting function.

Value

  • a function that generalizes fun to handle a formula/data frame interface.

Examples

Run this code
foo <- aggregatingFunction1( base::mean )
foo( ~length, data=KidsFeet )
base::mean(KidsFeet$length)
foo( length ~ sex, data=KidsFeet )

Run the code above in your browser using DataLab