mosaic (version 0.14.4)

dfapply: 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

Run this code
# NOT RUN {
dfapply(iris, favstats, select = is.numeric)
dfapply(iris, favstats, select = c(TRUE, TRUE, FALSE, FALSE, FALSE))
dfapply(iris, favstats, select = c(1,2))
dfapply(iris, favstats, select = c("Sepal.Length", "Petal.Length"))
dfapply(HELPrct, table, select = is.factor)
do.call(rbind, dfapply(HELPrct, favstats, select = is.numeric))
# }

Run the code above in your browser using DataCamp Workspace