dput(base)
dput()所属R语言包:base
Write an Object to a File or Recreate it
写一个文件对象或重新
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Writes an ASCII text representation of an R object to a file or connection, or uses one to recreate the object.
写一个R对象的ASCII文本表示文件或连接,或使用一个重新创建对象。
用法----------Usage----------
dput(x, file = "",
control = c("keepNA", "keepInteger", "showAttributes"))
dget(file)
参数----------Arguments----------
参数:x
an object.
一个对象。
参数:file
either a character string naming a file or a connection. "" indicates output to the console.
无论是一个字符串,命名一个文件或一个连接。 ""表示输出到控制台。
参数:control
character vector indicating deparsing options. See .deparseOpts for their description.
特征向量表示deparsing选项。看到.deparseOpts他们的描述。
Details
详情----------Details----------
dput opens file and deparses the object x into that file. The object name is not written (unlike dump). If x is a function the associated environment is stripped. Hence scoping information can be lost.
dput打开file和deparses对象x到该文件。不写对象的名称(不像dump)。如果x是一个功能相关的环境中被剥离。因此范围的信息可能会丢失。
Deparsing an object is difficult, and not always possible. With the default control, dput() attempts to deparse in a way that is readable, but for more complex or unusual objects (see dump, not likely to be parsed as identical to the original. Use control = "all" for the most complete deparsing; use control = NULL for the simplest deparsing, not even including attributes.
Deparsing对象是困难的,并不总是可能的。与默认control,dput()尝试deparse是可读的方式,但更复杂的或不寻常的对象(见dump,不太可能被视为相同的原始解析。使用control = "all"最完整deparsing;利用control = NULL简单deparsing的,甚至不包括属性。
dput will warn if fewer characters were written to a file than expected, which may indicate a full or corrupt file system.
dput会发出警告,如果比预期的文件更少的字符被写入,这可能预示着一个完整的或损坏的文件系统。
To display saved source rather than deparsing the internal representation include "useSource" in control. R currently saves source only for function definitions.
若要显示保存的源,而非deparsing内部表示,包括"useSource"control的。 R现在只保存函数定义的源。
值----------Value----------
For dput, the first argument invisibly.
dput,无形的第一个参数。
For dget, the object created.
dget,创建的对象。
注意----------Note----------
To avoid the risk of a source attribute out of sync with the actual function definition, the source attribute of a function will never be written as an attribute.
为了避免风险源属性的同步与实际的函数定义,函数的源属性将永远不会被写入属性。
参考文献----------References----------
The New S Language. Wadsworth & Brooks/Cole.
参见----------See Also----------
deparse, dump, write.
deparse,dump,write。
举例----------Examples----------
## Write an ASCII version of mean to the file "foo"[#写一个ASCII版本的意思是“foo”的文件]
dput(mean, "foo")
## And read it back into 'bar'[#和读取它放回条形]
bar <- dget("foo")
unlink("foo")
## Create a function with comments[#创建一个具有评论功能。]
baz <- function(x) {
# Subtract from one[减去一]
1-x
}
## and display it[#显示]
dput(baz)
## and now display the saved source[#现在显示保存的源]
dput(baz, control = "useSource")
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|