Type: | Package |
Title: | List with Defaults |
Version: | 1.2.0 |
Date: | 2017-06-07 |
Author: | Russell S. Pierce |
Maintainer: | Russell S. Pierce <russell.s.pierce@gmail.com> |
Description: | Provides a function that, as an alternative to base::list, allows default values to be inherited from another list. |
URL: | https://github.com/drknexus/listWithDefaults |
BugReports: | https://github.com/drknexus/listWithDefaults |
License: | GPL-2 |
Suggests: | testthat, rmarkdown, covr |
Imports: | assertthat |
RoxygenNote: | 6.0.1 |
NeedsCompilation: | no |
Packaged: | 2017-06-08 15:21:47 UTC; ubuntu |
Repository: | CRAN |
Date/Publication: | 2017-06-08 15:29:11 UTC |
listWithDefaults
Description
Takes arguments as base::list
to create a list.
If any arguments are present in defaultList
, but absent in ..., then the values from defaultList
are used.
Usage
listWithDefaults(..., defaultList = NULL)
Arguments
... |
objects, must be named; alternatively a single argument may be provided in this position as a named list |
defaultList |
a named list containing the default values |
Note
Argument order is not controlled. Non-default arguments come first in the order specified followed by all default arguments.
Examples
listWithDefaults(defaultList=list(a=2,b=2))
listWithDefaults(a=1,defaultList=list(a=2,b=2))
listWithDefaults(b=1,defaultList=list(a=2,b=2))
listWithDefaults(a=1,b=1,defaultList=list(a=2,b=2))
listWithDefaults(list(a=1),defaultList=list(a=2,b=2))