Replaces functions that are NULL or missing in a specified environment with functions whose body is
NULL; NULL and
have empty arguments as specified.
environment. Environment in which the functions are to be found and replaced.
named list. Names are names of functions in
1 2 3 4 5 6
env_curr <- environment() fn1 <- function(x) x; fn2 <- function(x = 2) y; fn3 <- NULL expected_params <- list(fn1 = 'x', fn2 = 'y', fn3 = 'x') .replace_null_fns(env = env_curr, expected_params = expected_params) fn3 # replaced to have a function with arguments as specified by expected_params fn2; fn1 # no change in either
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.