extract and assign default function arguments to the global environment
Source:R/extract.R
extract_params.RdThis function extracts the default arguments of a given function and assigns them to variables in the global environment. It is particularly useful for debugging when you need quick access to the default values.
Note
This function modifies the global environment by assigning variables. This is intentional for debugging purposes but should be used with caution in production code.
Examples
rejection_sampler <- function(D, n_trails = 10000, seed = 2024) {}
extract_params(rejection_sampler)
print(n_trails)
#> [1] 10000
# 10000