Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

funs

Create a list of function calls


Description

[Deprecated]

funs() is deprecated; please use list() instead. We deprecated this function because it provided a unique way of specifying anonymous functions, rather than adopting the conventions used by purrr and other packages in the tidyverse.

Usage

funs(..., .args = list())

Arguments

...

<data-masking> A list of functions specified by:

  • Their name, "mean"

  • The function itself, mean

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

The following notations are not supported, see examples:

  • An anonymous function, function(x) mean(x, na.rm = TRUE)

  • An anonymous function in purrr notation, ~mean(., na.rm = TRUE)

.args, args

A named list of additional arguments to be added to all function calls. As funs() is being deprecated, use other methods to supply arguments: ... argument in scoped verbs or make own functions with purrr::partial().

Examples

funs("mean", mean(., na.rm = TRUE))
# ->
list(mean = mean, mean = ~ mean(.x, na.rm = TRUE))

funs(m1 = mean, m2 = "mean", m3 = mean(., na.rm = TRUE))
# ->
list(m1 = mean, m2 = "mean", m3 = ~ mean(.x, na.rm = TRUE))

dplyr

A Grammar of Data Manipulation

v1.0.6
MIT + file LICENSE
Authors
Hadley Wickham [aut, cre] (<https://orcid.org/0000-0003-4757-117X>), Romain François [aut] (<https://orcid.org/0000-0002-2444-4226>), Lionel Henry [aut], Kirill Müller [aut] (<https://orcid.org/0000-0002-1416-3412>), RStudio [cph, fnd]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.