set_fun_env: set environment for function

View source: R/set_fun_env.R

set_fun_envR Documentation

set environment for function

Description

This function can set/reset the environment of a function. This is e.g. used in function replace_package_fun where a function in a package is replaced by a global one. In such a case the environment of the function should be changed to that of the package otherwise other package functions can not be used.

Usage

set_fun_env(fn, ns = NULL, envir = globalenv())

Arguments

fn

Character with name of function

ns

Character with name of package

envir

Environment in which the environment statement is executed

Value

the environment that is set (invisible)

Details

See blog entry for an example of use.

Examples

## Not run: 
set_fun_env('fun','HOQCutil')

## End(Not run)

HanOostdijk/HOQCutil documentation built on July 28, 2023, 5:56 p.m.