objcopy(names, where.new, new.names=names, where.old=1, overwrite=F)
where.new
can be either a number or an object defining a database. A number is
interpreted as the corresponding element of the search list.
See the help file for
assign for more details.
where.new should
be overwritten. If any of
new.names exist already on
where.new
and
overwrite=FALSE, an error is generated and nothing is assigned.
new.names is invisibly returned.
names are assigned on database
where.new under
new.names.
The database
where.new must be writeable.
Assignments by
objcopy are committed only when the current top-level
expression completes without error, or when
synchronize is used.
This function is unrelated to the
copy function in the S-PLUS
library section
external.
z <- z # find z somewhere and make a copy on the working database
objcopy("x", 2) # copy x from database 1 to database 2
assign("x", get("x", where=1), where=2) # Same thing.
assign("x", x, where=2) # Same thing, if x is found on database 1.
objcopy("x", 2, "y") # copy x from d.b. 1 to d.b. 2 under name y
assign("y", get("x", where=1), where=2) # Same thing.
assign("y", x, where=2) # Same thing, if x is found on database 1.
objcopy(c("X", "Y", "Z"), 2) # copy all three from d.b. 1 to d.b. 2
old.names <- c("X", "Y", "Z")
objcopy(old.names, 1, paste(old.names, "backup", sep="."))
# make backup copies X.backup etc. on the same database, 1
objcopy("myfun", "S_stash")
# S_stash is a directory of S-PLUS objects you want to keep.
# It need not be currently attached.