Learn R Programming

SpaDES (version 1.2.0)

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)
"changeObjEnv"(x, toEnv, fromEnv, rmSrc)
"changeObjEnv"(x, toEnv)
"changeObjEnv"(x, fromEnv)
"changeObjEnv"(x, toEnv, rmSrc)
"changeObjEnv"(x, fromEnv, rmSrc)
"changeObjEnv"(x, toEnv, fromEnv)
"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
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