Learn R Programming

mosaic (version 0.13.0)

aggregatingFunction2: 2-ary Aggregating functions

Description

aggregatinFuntion2 creates statistical summaries of two numerical vectors that are formula aware.

Usage

aggregatingFunction2(fun)

Arguments

fun
a function that takes two numeric vectors and computes a summary statistic, returning a numeric vector of length 1.

Value

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

Examples

Run this code
if(require(mosaicData)) {
  foo <- aggregatingFunction2( stats::cor)
  foo( length ~ width, data=KidsFeet )
   stats::cor( KidsFeet$length, KidsFeet$width )
}

Run the code above in your browser using DataLab