copyEnv {Biobase}R Documentation

Functionality to copy environments

Description

These functions can be used to make copies of environments, or to get/assign all of the objects inside of an environment

Usage

copyEnv(oldEnv, newEnv = new.env(parent = parent.env(oldEnv)), recurse = FALSE)
env2list(envir, recurse=FALSE)
list2env(vals, envir, recurse=FALSE)

Arguments

oldEnv An environment to copy from
newEnv An environment to copy to. Default is a new environment with the same parent environment as oldEnv.
envir An environment to get/set values to
vals A named list of objects to assign into an environment
recurse Whether to recurse upwards through the environment hierarchy

Details

env2list: This function will retrieve the objects from an environment and return them in a named list (names being the names of the objects). list2env: This function will take a named list and assign all of its elements into the environment (using the names to name the objects). copyEnv: This function will make a copy of the contents from oldEnv and place them into newEnv.

Author(s)

Jeff Gentry

See Also

environment

Examples

   z <- new.env()
   multiassign(c("a","b","c"),c(1,2,3),z)

   a <- copyEnv(z)
   ls(a)

   q <- env2list(z)
   g <- new.env()
   g <- list2env(q,g)   
   ls(g)

[Package Contents]