load(base)
load()所属R语言包:base
Reload Saved Datasets
重新载入保存的数据集
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Reload datasets written with the function save.
刷新与功能save写的数据集。
用法----------Usage----------
load(file, envir = parent.frame())
参数----------Arguments----------
参数:file
a (readable binary-mode) connection or a character string giving the name of the file to load (when tilde expansion is done).
(可读的二进制模式)连接或一个字符串给加载的文件名(波浪线扩建完成时)。
参数:envir
the environment where the data should be loaded.
应的数据加载的环境。
Details
详情----------Details----------
load can load R objects saved in the current or any earlier format. It can read a compressed file (see save) directly from a file or from a suitable connection (including a call to url).
load可以装载在目前或先前任何格式保存的R对象。它可以读取压缩文件(见save)直接从一个文件或一个合适的连接(调用url包括)。
A not-open connection will be opened in mode "rb" and closed after use. Any connection other than a gzfile or gzcon connection will be wrapped in gzcon to allow compressed saves to be handled: note that this leaves the connection in an altered state (in particular, binary-only), and that it needs to be closed explicitly (it will not be garbage-collected).
将打开一个不开放的连接模式"rb"使用后关闭。以外的其他任何连接gzfile或gzcon连接将被包装在gzcon允许压缩保存处理:注意,这叶子改变状态的连接(尤其是二进制只),而且它需要明确被关闭(它不会被垃圾收集的)。
Only R objects saved in the current format (used since R 1.4.0) can be read from a connection. If no input is available on a connection a warning will be given, but any input not in the current format will result in a error.
只有R对象保存在当前的格式(1.4.0由于R),可以读出一个连接。如果没有输入连接将被警告,但在当前的格式输入任何将导致一个错误。
Loading from an earlier version will give a warning about the "magic number": magic numbers 1971:1977 are from R < 0.99.0, and RD[ABX]1 from R 0.99.0 to R 1.3.1. These are all obsolete, and you are strongly recommended to re-save such files in a current format.
从早期版本的载入将给予警告:关于“幻数”幻数1971:1977是从R <0.99.0,RD[ABX]1从R 0.99.0到ŕ1.3.1。这些都是过时的,强烈建议您重新保存在当前的格式等文件。
值----------Value----------
A character vector of the names of objects created, invisibly.
创建一个对象的名称,特征向量,无形之中。
警告----------Warning----------
Saved R objects are binary files, even those saved with ascii = TRUE, so ensure that they are transferred without conversion of end of line markers. load tries to detect such a conversion and gives an informative error message.
保存的R对象是二进制文件,甚至那些保存ascii = TRUE,以便确保它们没有行标记结束转换转入。 load尝试,以检测这种转换,并给出了一个内容丰富的错误信息。
注意----------Note----------
file can be a UTF-8-encoded filepath that cannot be translated to the current locale.
file可以是UTF-8编码文件路径不能转换为当前的语言环境。
参见----------See Also----------
save, download.file.
save,download.file。
For other interfaces to the underlying serialization format, see unserialize and readRDS.
对于其他接口底层的序列化格式,请参阅unserialize和readRDS。
举例----------Examples----------
## 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")
## Not run: [#无法运行:]
con <- url("http://some.where.net/R/data/example.rda")
## print the value to see what objects were created.[#打印的价值,看到哪些对象被创建。]
print(load(con))
close(con) # url() always opens the connection[网址()总是打开连接]
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|