dot-replace_null_fns: Replace NULL functions

Description Usage Arguments Examples

Description

Replaces functions that are NULL or missing in a specified environment with functions whose body is NULL; NULL and have empty arguments as specified.

Usage

1
.replace_null_fns(env, expected_params)

Arguments

env

environment. Environment in which the functions are to be found and replaced.

expected_params

named list. Names are names of functions in env and values are character vectors specifying parameters for functions.

Examples

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

MiguelRodo/gamlsspipeline documentation built on July 25, 2020, 7:23 p.m.