SpaDES (version 1.3.1)

changeObjEnv: Copy or move objects from one environment to another

Description

This will copy or move (if rmSrc=TRUE) objects passed as a character string to a different environment. This is used with a spades call to copy or move objects to the envir environment object.

Usage

changeObjEnv(x, toEnv, fromEnv, rmSrc)

# S4 method for character,environment,environment,logical changeObjEnv(x, toEnv, fromEnv, rmSrc)

# S4 method for character,environment,missing,missing changeObjEnv(x, toEnv)

# S4 method for character,missing,environment,missing changeObjEnv(x, fromEnv)

# S4 method for character,environment,missing,logical changeObjEnv(x, toEnv, rmSrc)

# S4 method for character,missing,environment,logical changeObjEnv(x, fromEnv, rmSrc)

# S4 method for character,environment,environment,missing changeObjEnv(x, toEnv, fromEnv)

# S4 method for list,ANY,ANY,ANY changeObjEnv(x, toEnv, fromEnv, rmSrc)

Arguments

x

objects passed as character string vector

toEnv

environment to copy or move to

fromEnv

environment to copy or move from

rmSrc

should the source copies of the objects be removed. Default is FALSE.

Examples

Run this code
# NOT RUN {
e1 <- new.env()
e2 <- new.env()
assign("a1", 1:1e3, envir = e1)
assign("a2", 1:1e3, envir = e1)
objs <- c("a1", "a2")
# move objects between environments

changeObjEnv(objs, fromEnv = e1, toEnv = e2)

# }

Run the code above in your browser using DataLab