Learn R Programming

geo (version 1.4-3)

apply.shrink: Apply a function to a vector for a combination of categories.

Description

Apply a function to a vector for a combination of categories.

Usage

apply.shrink(X, INDICES, FUN = NULL, names, ...)

Arguments

X
Input data to FUN
INDICES
list of categories to be combined
FUN
Function to be applied
names
Column names for the resulting dataframe
...
Additional arguments to FUN

Value

Dataframe of outcomes applying FUN to X for the combination of categories in INDICES

See Also

apply.shrink.dataframe, merge

Examples

Run this code
## stupid example, showing naming of results
names(apply.shrink(depthloc$z,
  list(a=round(depthloc$lat), b=round(depthloc$lon)), mean))
names(apply.shrink(depthloc$z, list(round(depthloc$lat),
  round(depthloc$lon)), mean, names = c("a", "b", "z")))

Run the code above in your browser using DataLab