Skip to content

Commit

Permalink
copy_env() can selectively copy variables from one envir to another
Browse files Browse the repository at this point in the history
  • Loading branch information
yihui committed Jun 4, 2012
1 parent 0869c3c commit f64c872
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions R/utils.R
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
## copy objects in one environment to the other
copy_env = function(from, to) {
x = ls(envir = from, all.names = TRUE)
for (i in x) {
assign(i, get(i, envir = from, inherits = FALSE), envir = to)
}
copy_env = function(from, to, keys = ls(envir = from, all.names = TRUE)) {
for (i in keys) assign(i, get(i, envir = from, inherits = FALSE), envir = to)
}


Expand Down

0 comments on commit f64c872

Please sign in to comment.