copy.obj Facilitates the renaming, copying, and moving of objects within and across environments. If to.env is NULL, the execution will simply replace the object under a new name. If to.env has multiple values, the copy or move operations will populate each environment.

copy_obj(
  ...,
  from_env = .GlobalEnv,
  to_env = .GlobalEnv,
  keep.orig = TRUE,
  chatty = FALSE
)

Arguments

...

(dots_list) String(s) giving the names of the object(s) to be moved: may include environment prefix (e.g., FROM_ENV$from.name). Elements given as a key-value pair will have the names of keys become the destination object names; otherwise, the value is (parsed and ) used as the destination name. For example, ... = list(a = this, that, TO_ENV$the_other = other) results in three destination objects named a, that, and the_other with the_other created in environment TO_ENV.

from_env

(string| .GlobalEnv): The default source environment of the object(s) to be moved/copied

to_env

(string| .GlobalEnv): The default target environment of the target object

keep.orig

(logical | TRUE): When FALSE, the original is removed via rm

chatty

(logical | FALSE) Verbosity flag

See also

Other Chapter 1 - Environment Processing: load_unloaded(), refer.to(), save_image()