funs: Create a list of functions calls.

Description Usage Arguments Examples

View source: R/funs.R

Description

funs provides a flexible way to generate a named list of functions for input to other functions like summarise_each.

Usage

1
2
3
funs(...)

funs_(dots, args = list(), env = baseenv())

Arguments

dots, ...

A list of functions specified by:

  • Their name, "mean"

  • The function itself, mean

  • A call to the function with . as a dummy parameter, mean(., na.rm = TRUE)

args

A named list of additional arguments to be added to all function calls.

env

The environment in which functions should be evaluated.

Examples

1
2
3
4
5
6
7
8
funs(mean, "mean", mean(., na.rm = TRUE))

# Overide default names
funs(m1 = mean, m2 = "mean", m3 = mean(., na.rm = TRUE))

# If you have function names in a vector, use funs_
fs <- c("min", "max")
funs_(fs)

sctyner/dplyr050 documentation built on May 17, 2019, 2:22 p.m.