set_default_params {ezknitr} | R 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)
[Package ezknitr version 0.6.3 Index]