dfapply {mosaicCore}R Documentation

apply-type function for data frames

Description

An apply-type function for data frames.

Usage

dfapply(data, FUN, select = TRUE, ...)

Arguments

data

data frame

FUN

a function to apply to (some) variables in the data frame

select

a logical, character (naming variables), or numeric vector or a function used to select variables to which FUN is applied. If a function, it should take a vector as input and return a single logical. See examples.

...

arguments passed along to FUN

See Also

apply(), sapply(), tapply(), lapply(), inspect()

Examples

dfapply(iris, mean, select = is.numeric)
dfapply(iris, mean, select = c(1,2))
dfapply(iris, mean, select = c("Sepal.Length", "Petal.Length"))
if (require(mosaicData)) {
  dfapply(HELPrct, table, select = is.factor)
  do.call(rbind, dfapply(HELPrct, mean, select = is.numeric))
}

[Package mosaicCore version 0.9.4.0 Index]