避免load()自动命名数据框

时间:2016-09-29 17:21:10

标签: r

来自load help page

## save all data
xx <- pi # to ensure there is some data

save(list = ls(all = TRUE), file= "all.RData")
rm(xx)

## restore the saved values to the current environment
local({
   load("all.RData")
   ls()
})

xx <- exp(1:3)
## restore the saved values to the user's workspace
load("all.RData") ## which is here *equivalent* to
## load("all.RData", .GlobalEnv)
## This however annihilates all objects in .GlobalEnv with the same names !
xx # no longer exp(1:3)
rm(xx)
attach("all.RData") # safer and will warn about masked objects w/ same name in .GlobalEnv

我想知道:除了附加数据以防止来自&#34;除去.GlobalEnv中具有相同名称的所有对象&#34;?提前谢谢

0 个答案:

没有答案