set_default_params: Set default parameters

View source: R/set_default_params.R

set_default_paramsR Documentation

Set default parameters

Description

Create variables with the given values only if these variables do not currently exist.

Usage

set_default_params(params)

Arguments

params

List of parameters.

Details

Sometimes it may be useful to define a variable only it hasn't been defined yet. One example where this can be useful is when you have an Rmd script that uses some variables and you want to be able to use custom values for these variables, but also give them a default value in the script in case they are not set beforehand.

Examples

exists("foo")
exists("bar")
foo <- 5
set_default_params(list(foo = 10, bar = 20))
print(foo)
print(bar)

daattali/ezrender documentation built on Aug. 20, 2023, 3:29 a.m.