ellipsis v0.3.1


Monthly downloads



Tools for Working with ...

The ellipsis is a powerful tool for extending functions. Unfortunately this power comes at a cost: misspelled arguments will be silently ignored. The ellipsis package provides a collection of functions to catch problems and alert the user.



maturing CRAN
status Travis build
status Codecov test

Adding ... to a function is a powerful technique because it allows you to accept any number of additional arguments. Unfortunately it comes with a big downside: any misspelled or extraneous arguments will be silently ignored. This package provides tools for making ... safer:

  • check_dots_used() errors if any components of ... are not evaluated. This allows an S3 generic to state that it expects every input to be evaluated.

  • check_dots_unnamed() errors if any components of ... are named. This allows you to collect arbitrary unnamed arguments, warning if the user misspells a named argument.

  • check_dots_empty() errors if ... is used. This allows you to use ... to force the user to supply full argument names, while still warning if an argument name is misspelled.

Thanks to Jenny Bryan for the idea, and Lionel Henry for the heart of the implementation.


Install the released version from CRAN:


Or the development version from GitHub:



mean() is a little dangerous because you might expect it to work like sum():

sum(1, 2, 3, 4)
#> [1] 10
mean(1, 2, 3, 4)
#> [1] 1

This silently returns the incorrect result because mean() has arguments x and .... The ... silently swallows up the additional arguments. We can use ellipsis::check_dots_used() to check that every input to ... is actually used:

safe_mean <- function(x, ..., trim = 0, na.rm = FALSE) {
  mean(x, ..., trim = trim, na.rm = na.rm)

safe_mean(1, 2, 3, 4)
#> Error: 3 components of `...` were not used.
#> We detected these problematic arguments:
#> * `..1`
#> * `..2`
#> * `..3`
#> Did you misspecify an argument?

Functions in ellipsis

Name Description
check_dots_unnamed Check that all dots are unnamed
ellipsis-package ellipsis: Tools for Working with ...
safe_median Safe version of median
check_dots_empty Check that dots are unused
check_dots_used Check that all dots have been used
dots_empty Helper for consistent documentation of empty dots
dots_used Helper for consistent documentation of used dots
No Results!

Last month downloads


License GPL-3
Encoding UTF-8
LazyData true
RoxygenNote 7.1.0
URL https://ellipsis.r-lib.org, https://github.com/r-lib/ellipsis
BugReports https://github.com/r-lib/ellipsis/issues
NeedsCompilation yes
Packaged 2020-05-15 05:57:33 UTC; lionel
Repository CRAN
Date/Publication 2020-05-15 14:10:06 UTC
suggests covr , testthat
depends R (>= 3.2)
imports rlang (>= 0.3.0)
Contributors RStudio

Include our badge in your README