util.agg.value: generalized aggregation function

Description Usage Arguments Value Examples

View source: R/utils-prep.R

Description

generalized aggregation function, handy when use together with summarise_all

Usage

1
util.agg.value(x, agg.func = max)

Arguments

x

input series/array

agg.func

the aggregation function

Value

the aggregated value

Examples

1
2
3
4
util.agg.value(c(rep(1,4), rep(2, 10)), agg.func = mean)
util.agg.value(c(rep('a',4), rep('b', 10)), agg.func = util.get.mode)
library(dplyr)
mtcars %>% summarise_all(function(i) util.agg.value(i, util.get.mode))

6chaoran/lh2util documentation built on Nov. 29, 2020, 1:28 a.m.