Skip to contents

Wrapper for by that returns a data frame

Usage

by_df(data, INDICES, FUN, ..., simplify = TRUE, bind_fx = rbind)

Arguments

data

an R object, normally a data frame, possibly a matrix.

INDICES

a factor or a list of factors, each of length nrow(data). For the data frame method, INDICES can also be a formula as in the f argument of the split method for data frames.

FUN

a function to be applied to (usually data-frame) subsets of data.

...

Arguments passed on to base::by

simplify

logical: see tapply.

bind_fx

Binding function for the output (e.g., rbind or cbind).

Value

Data frame with the output of by