Copy or move objects from one environment to another

Share:

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
changeObjEnv(x, toEnv, fromEnv, rmSrc)

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

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

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

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

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

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

## S4 method for signature '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.

Author(s)

Eliot Mcintire

Examples

1
2
3
4
5
6
7
8
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)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.