powered by
This function is a wrapper for calling lapply on the list resulting from first calling splitBy.
lapply_by(data, formula, FUN, ...)lapplyBy(formula, data = parent.frame(), FUN, ...)sapply_by(data, formula, FUN, ..., simplify = TRUE, USE.NAMES = TRUE)sapplyBy( formula, data = parent.frame(), FUN, ..., simplify = TRUE, USE.NAMES = TRUE )
lapplyBy(formula, data = parent.frame(), FUN, ...)
sapply_by(data, formula, FUN, ..., simplify = TRUE, USE.NAMES = TRUE)
sapplyBy( formula, data = parent.frame(), FUN, ..., simplify = TRUE, USE.NAMES = TRUE )
A list.
A dataframe.
A formula describing how data should be split.
A function to be applied to each element in the split list, see 'Examples' below.
optional arguments to FUN.
Same as for sapply
sapply
Søren Højsgaard, sorenh@math.aau.dk
splitBy, split_by
splitBy
split_by
fun <- function(x) range(x$uptake) lapplyBy(~Treatment + Type, data=CO2, FUN=fun) sapplyBy(~Treatment + Type, data=CO2, FUN=fun) # Same as lapply(splitBy(~Treatment + Type, data=CO2), FUN=fun)
Run the code above in your browser using DataLab