| dfapply | R Documentation |
An apply-type function for data frames.
dfapply(data, FUN, select = TRUE, ...)
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 |
... |
arguments passed along to |
apply(),
sapply(),
tapply(),
lapply(),
inspect()
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))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.