Learn R Programming

nlme (version 3.1-31)

gapply: Apply a Function by Groups

Description

Applies the function to the distinct sets of rows of the data frame defined by groups.

Usage

gapply(object, which, FUN, form, level, groups, ...)

Arguments

Value

Returns a data frame with as many rows as there are levels in the groups argument.

See Also

gsummary

Examples

Run this code
data( Phenobarb )
## Find number of non-missing "conc" observations for each Subject
gapply( Phenobarb, FUN = function(x) sum(!is.na(x$conc)) )

Run the code above in your browser using DataLab