dots: Set an advanced argument

Description Usage Arguments Details Author(s) See Also Examples

View source: R/pvdiv_gwas.R

Description

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.

Usage

1
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.

Author(s)

L. Collado-Torres

See Also

dotsMethods

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## 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)
minMax(1:2, 3:4, minValue = 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.

Alice-MacQueen/switchgrassGWAS documentation built on Jan. 23, 2022, 7:55 p.m.