This function is taken from the lcolladotor/dots package. It is the only function used from this package and is added to this package wholesale to reduce user installation burden. Please use the original package from Github if you use this in your own work.

dots(name, value, ...)

Arguments

name

Name of the advanced argument to look for in ...

value

The default value of the advanged argument. If this advanced argument is used in several of your functions, we recommend using getOption('value') and explaining this option in your package vignette geared towards experienced users.

...

Advanced arguments. See dotsMethods.

Details

From the ... argument used in your function, find if a specific argument was included and extract its value.

Note that you can make dots() even more powerful by using getOption to define value. This is particularly useful if you use the same advanced argument in several functions.

See also

Author

L. Collado-Torres

Examples


## Simple example that calculates the max between 'x' and 'y' with a
## specified minimum value to return.

minMax <- function(x, y, ...) {
    minValue <- dots('minValue', 0, ...)
    res <- max(x, y, minValue)
    return(res)
}
minMax(1:2, 3:4)
#> [1] 4
minMax(1:2, 3:4, minValue = 5)
#> [1] 5


## Arguably these examples are simple, but the idea is that dots()
## can simplify very long function calls where some parameters will be used
## by a minority of the users.