File: funs.Rd

package info (click to toggle)
r-cran-dplyr 1.1.4-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,292 kB
  • sloc: cpp: 1,403; sh: 17; makefile: 7
file content (47 lines) | stat: -rw-r--r-- 1,697 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/deprec-funs.R
\name{funs}
\alias{funs}
\title{Create a list of function calls}
\usage{
funs(..., .args = list())
}
\arguments{
\item{...}{<\code{\link[rlang:args_data_masking]{data-masking}}> A list of functions
specified by:
\itemize{
\item Their name, \code{"mean"}
\item The function itself, \code{mean}
\item A call to the function with \code{.} as a dummy argument,
\code{mean(., na.rm = TRUE)}
}

The following notations are \strong{not} supported, see examples:
\itemize{
\item An anonymous function, \code{function(x) mean(x, na.rm = TRUE)}
\item An anonymous function in \pkg{purrr} notation, \code{~mean(., na.rm = TRUE)}
}}

\item{.args, args}{A named list of additional arguments to be added to all
function calls. As \code{funs()} is being deprecated, use other methods to
supply arguments: \code{...} argument in \link[=summarise_at]{scoped verbs} or make
own functions with \code{\link[purrr:partial]{purrr::partial()}}.}
}
\description{
\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}}

\code{funs()} is deprecated; please use \code{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.
}
\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))
}
\keyword{internal}