bind_to_env: Bind an object to an environment

Description Usage Arguments Value Author(s) See Also Examples

Description

Bind an object to an environment. If the object is a function then the environment of the function is also set to the environment.

Usage

1
bind_to_env(object, envir)

Arguments

object

of any type

envir

environment to which to bind object

Value

invisible

Author(s)

Thomas P. Harte

See Also

environment, function

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
   e<- new.env()

   x<- 1:3
   `fun`<- function() {
       x
   }

   bind_to_env(x, env=e)
   bind_to_env(fun, env=e)
   x<- 1:10

   all.equal(
       fun(), 1:10
   )

   whos(sort="Name", env=e, omit=NULL)

tharte/tutils documentation built on Feb. 11, 2020, 9:17 a.m.