找回密码
 注册
查看: 2573|回复: 0

R语言:dcf()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-2-17 10:11:36 | 显示全部楼层 |阅读模式
dcf(base)
dcf()所属R语言包:base

                                        Read and Write Data in DCF Format
                                         DCF格式的读取和写入数据

                                         译者:生物统计家园网 机器人LoveR

描述----------Description----------

Reads or writes an R object from/to a file in Debian Control File format.
读取或写入/ R对象从Debian控制文件格式的文件。


用法----------Usage----------


read.dcf(file, fields = NULL, all = FALSE, keep.white = NULL)

write.dcf(x, file = "", append = FALSE,
          indent = 0.1 * getOption("width"),
          width = 0.9 * getOption("width"),
          keep.white = NULL)



参数----------Arguments----------

参数:file
either a character string naming a file or a connection. "" indicates output to the console.  For read.dcf this can name a compressed file (see gzfile).
无论是一个字符串,命名一个文件或一个连接。 ""表示输出到控制台。 read.dcf这个可以命名一个压缩文件(见gzfile)。


参数:fields
Fields to read from the DCF file.  Default is to read all fields.
从DCF文件阅读领域。默认是读取各个领域。


参数:all
a logical indicating whether in case of multiple occurrences of a field in a record, all these should be gathered. If all is false (default), only the last such occurrence is used.
不论在记录中的字段多次出现的情况下,逻辑表明,所有这些应收集。 all如果是假的(默认),只有最后一次出现这样的使用。


参数:keep.white
a character string with the names of the fields for which whitespace should be kept as is, or NULL (default) indicating that there are no such fields.  Coerced to character if possible.  For fields where whitespace is not to be kept as is, read.dcf removes leading and trailing whitespace, and write.dcf folds using strwrap.  
一个字段的名称为空格应尽可能的字符串,或NULL(默认)表示,有没有这样的领域。强制字符,如果可能的话。对于空白不被保持的领域,read.dcf删除前导和尾随空白,write.dcf折叠使用strwrap。


参数:x
the object to be written, typically a data frame.  If not, it is attempted to coerce x to a data frame.
要写入的对象,通常是一个数据框。如果不是,它是试图强迫x到一个数据框。


参数:append
logical.  If TRUE, the output is appended to the file.  If FALSE, any existing file of the name is destroyed.
逻辑。如果TRUE,输出追加到文件。如果FALSE,任何现有文件的名称被摧毁。


参数:indent
a positive integer specifying the indentation for continuation lines in output entries.
一个正整数,指定输出项的续行的缩进。


参数:width
a positive integer giving the target column for wrapping lines in the output.
一个正整数,使包装在输出线的目标列。


Details

详情----------Details----------

DCF is a simple format for storing databases in plain text files that can easily be directly read and written by humans.  DCF is used in various places to store R system information, like descriptions and contents of packages.
DCF是一种简单的格式,可以很容易地直接读取和由人类编写的纯文本文件存储在数据库。 DCF是在不同的地方使用,存储R系统的信息,如包的描述和内容。

The DCF rules as implemented in R are:
研发实施的DCF规则是:

A database consists of one or more records, each with one or more named fields.  Not every record must contain each field. Fields may appear more than once in a record.
一个数据库由一个或多个记录,每一个或多个命名字段。不是每个记录必须包含每个字段。领域可能会出现不止一次在创纪录的。

Regular lines start with a non-whitespace character.
常规线路开始与一个非空白字符。

Regular lines are of form tag:value, i.e., have a name tag and a value for the field, separated by : (only the first : counts).  The value can be empty (i.e., whitespace only).
常规线路形式tag:value,即,有一个名字标签和一个字段的值,:(只在第一个:计数)分隔。该值可以是空的(即空白只)。

Lines starting with whitespace are continuation lines (to the preceding field) if at least one character in the line is non-whitespace.  Continuation lines where the only non-whitespace character is a . are taken as blank lines (allowing for multi-paragraph field values).
用空格开始的行是续行(前场),如果至少有一个特点是在该行的非空白。续行唯一的非空白字符是1 .空白行(允许多段字段值)。

Records are separated by one or more empty (i.e., whitespace only) lines.
记录是由一个或多个空(即,只有空白)线分开。

Note that read.dcf(all = FALSE) reads the file byte-by-byte. This allows a "DESCRIPTION" file to be read and only its ASCII fields used, or its Encoding field used to re-encode the remaining fields.
请注意,read.dcf(all = FALSE)读取字节的文件逐字节。这允许一个DESCRIPTION文件读取和其ASCII领域使用,或使用其Encoding场重新编码,其余领域。

write.dcf does not write NA fields.
write.dcf不写NA领域。


值----------Value----------

The default read.dcf(all = FALSE) returns a character matrix with one row per record and one column per field.  Leading and trailing whitespace of field values is ignored unless a field is listed in keep.white.  If a tag name is specified in the file, but the corresponding value is empty, then an empty string is returned.  If the tag name of a field is specified in fields but never used in a record, then the corresponding value is NA. If fields are repeated within a record, the last one encountered is returned.  Malformed lines lead to an error.
默认的read.dcf(all = FALSE)返回每个记录一行和一列每场一个字符矩阵。字段值中的前导和尾随空白将被忽略,除非字段keep.white的上市。如果文件中指定的标签名称,但相应的值是空的,然后返回一个空字符串。如果一个字段的标签名称指定在fields但从来没有使用记录中,那么相应的值是NA。如果字段重复记录中,遇到的最后一个返回。畸形行导致错误。

For read.dcf(all = TRUE) a data frame is returned, again with one row per record and one column per field.  The columns are lists of character vectors for fields with multiple occurrences, and character vectors otherwise.
read.dcf(all = TRUE)返回一个数据框,每个记录一行和一列每场。列列表中多次出现的领域,特征向量,否则的特征向量。

Note that an empty file is a valid DCF file, and read.dcf will return a zero-row matrix or data frame.
请注意,一个空的file是一个有效的DCF文件,和read.dcf将返回零行矩阵或数据框。

For write.dcf, invisible NULL.
write.dcf,无形的NULL。


参考文献----------References----------

Note that R does not require encoding in UTF-8, which is a recent Debian requirement.

参见----------See Also----------

write.table.
write.table。


举例----------Examples----------


## Create a reduced version of the 'CONTENTS' file in package 'splines'[#创建包样条线“的”内容“文件的简化版本]
x <- read.dcf(file = system.file("CONTENTS", package = "splines"),
              fields = c("Entry", "Description"))
write.dcf(x)


转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。


注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|生物统计家园 网站价格

GMT+8, 2025-1-22 21:45 , Processed in 0.027019 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表