azalea says

Save R Objects to a File and Reload Saved Datasets



用法 save(…, list = character(0), file = stop(“‘file’ must be specified”), ascii = FALSE, version = NULL, envir = parent.frame(), compress = !ascii, eval.promises = TRUE)

save.image(file = “.RData”, version = NULL, ascii = FALSE, compress = !ascii, safe = TRUE)

举例 x <- stats::runif(20) y <- list(a = 1, b = TRUE, c = “oops”) save(x, y, file = “xy.Rdata”) save.image() unlink(“xy.Rdata”) unlink(“.RData”)

set save defaults using option:

options(save.defaults=list(ascii=TRUE, safe=FALSE)) save.image() unlink(“.RData”) 更多…


用法: load(file, envir = parent.frame())


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() })

restore the saved values to the user’s workspace

load(“all.Rdata”, .GlobalEnv) unlink(“all.Rdata”) 更多…

programming R · Tweet Edit