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

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

[复制链接]
发表于 2012-2-16 20:20:52 | 显示全部楼层 |阅读模式
read.DIF(utils)
read.DIF()所属R语言包:utils

                                        Data Input from Spreadsheet
                                         从电子表格的数据输入

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

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

Reads a file in Data Interchange Format (DIF) and creates a data frame from it.  DIF is a format for data matrices such as single spreadsheets.
读取数据交换格式(DIF)的文件,并创建了一个从它的数据框。 DIF是一个数据矩阵,如单电子表格的格式。


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


read.DIF(file, header = FALSE,
           dec = ".", row.names, col.names,
           as.is = !stringsAsFactors,
           na.strings = "NA", colClasses = NA, nrows = -1,
           skip = 0, check.names = TRUE,
           blank.lines.skip = TRUE,
           stringsAsFactors = default.stringsAsFactors(),
           transpose = FALSE)



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

参数:file
the name of the file which the data are to be read from, or a connection, or a complete URL.  The name "clipboard" may also be used on Windows, in which case read.DIF("clipboard") will look for a DIF format entry in the Windows clipboard.  
是要读取的数据文件,或连接,或一个完整的URL名称。名称"clipboard"也可能被用来在Windows上,在这种情况下,read.DIF("clipboard")昼夜温差格式条目在Windows剪贴板。


参数:header
a logical value indicating whether the spreadsheet contains the names of the variables as its first line.  If missing, the value is determined from the file format: header is set to TRUE if and only if the first row contains only character values and the top left cell is empty.
一个逻辑值,指示是否在表格中包含的变量的名称作为其第一线。如果丢失,价值确定从文件格式:header设置为TRUE当且仅当第一行包含字符值和左上角的单元格是空的。


参数:dec
the character used in the file for decimal points.
字符用于在小数点文件。


参数:row.names
a vector of row names.  This can be a vector giving the actual row names, or a single number giving the column of the table which contains the row names, or character string giving the name of the table column containing the row names.  If there is a header and the first row contains one fewer field than the number of columns, the first column in the input is used for the row names.  Otherwise if row.names is missing, the rows are numbered.  Using row.names = NULL forces row numbering.  
向量的行名。这可以是一个向量,给予实际的行名,或一个号码表,其中包含的行名,或字符串,包含行名称表列的名称列。如果有一个头的第一行包含列数少一个领域,在输入的第一列用于行名称。否则,如果row.names丢失,行编号。使用row.names = NULL部队排编号。


参数:col.names
a vector of optional names for the variables. The default is to use "V" followed by the column number.
可选名称为变量的向量。默认是使用列数"V"其次。


参数:as.is
the default behavior of read.DIF is to convert character variables to factors.  The variable as.is controls the conversion of columns not otherwise specified by colClasses. Its value is either a vector of logicals (values are recycled if necessary), or a vector of numeric or character indices which specify which columns should not be converted to factors.  Note: In releases prior to R 2.12.1, cells marked as being of character type were converted to logical, numeric or complex using type.convert as in read.table.  Note: to suppress all conversions including those of numeric columns, set colClasses = "character".  Note that as.is is specified per column (not per variable) and so includes the column of row names (if any) and any columns to be skipped.  
read.DIF的默认行为转换成字符变量因素。变量as.is控制转换colClasses没有其他指定的列。它的值是一个逻辑值向量(如果有必要回收价值),或数字或字符索引指定的列不应该被转换为因素的向量。注:在ŕ2.12.1之前的版本,单元标记字符类型转换为逻辑,数字或复杂的使用type.convertread.table。注:禁止所有的转换,包括那些数字列,设置colClasses = "character"。请注意,as.is指定每列(而不是每个变量)等行名称的列(如有)及任何要跳过的列。


参数:na.strings
a character vector of strings which are to be interpreted as NA values.  Blank fields are also considered to be missing values in logical, integer, numeric and complex fields.
NA值作为解释的字符串的字符向量。空白领域也被认为是缺少逻辑,整数,数字和复杂的领域中的价值。


参数:colClasses
character.  A vector of classes to be assumed for the columns.  Recycled as necessary, or if the character vector is named, unspecified values are taken to be NA.  Possible values are NA (when type.convert is used), "NULL" (when the column is skipped), one of the atomic vector classes (logical, integer, numeric, complex, character, raw), or "factor", "Date" or "POSIXct".  Otherwise there needs to be an as method (from package methods) for conversion from "character" to the specified formal class.  Note that colClasses is specified per column (not per variable) and so includes the column of row names (if any).  
字符。须承担一个班的向量为列。必要时,回收或如果被命名为特征向量,未指定的值是NA。可能的值是NA(type.convert)"NULL"(列时跳过),一个原子的向量类(逻辑,整数,数字,复杂的,性格,生),或"factor","Date"或"POSIXct"。否则需要有一个as从methods转换到指定的正规类的方法(包"character")。请注意,colClasses指定每列(而不是每个变量)等行名称(如有)列。


参数:nrows
the maximum number of rows to read in.  Negative values are ignored.
被忽略的最大数量的行读入负值。


参数:skip
the number of lines of the data file to skip before beginning to read data.
行的数据文件数量开始读取数据前跳过。


参数:check.names
logical.  If TRUE then the names of the variables in the data frame are checked to ensure that they are syntactically valid variable names.  If necessary they are adjusted (by make.names) so that they are, and also to ensure that there are no duplicates.
逻辑。如果TRUE然后检查数据框中的变量的名称,以确保它们是语法上有效的变量名。如果有必要,他们调整(make.names),使他们,同时也确保没有重复。


参数:blank.lines.skip
logical: if TRUE blank lines in the input are ignored.
逻辑:如果TRUE在输入空行被忽略。


参数:stringsAsFactors
logical: should character vectors be converted to factors?
逻辑:特征向量转换的因素?


参数:transpose
logical, indicating if the row and column interpretation should be transposed.  Microsoft's Excel has been known to produce (non-standard conforming) DIF files which would need transpose = TRUE to be read correctly.
逻辑,表示如果行和列的解释应换位。微软的Excel已经知道生产不符合标准的DIF文件需要transpose = TRUE要正确读取。


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

A data frame (data.frame) containing a representation of the data in the file.  Empty input is an error unless col.names is specified, when a 0-row data frame is returned: similarly giving just a header line if header = TRUE results in a 0-row data frame.
一个数据框(data.frame)包含在文件中的数据的代表性。空的输入是一个错误,除非col.names被指定时,返回0行数据框:同样只是一个标题行,如果header = TRUE0行数据框中的结果。


注意----------Note----------

The columns referred to in as.is and colClasses include the column of row names (if any).
列称为as.is和colClasses包括行名称的列(如有)。

Less memory will be used if colClasses is specified as one of the six atomic vector classes.
将使用较少的内存,如果colClasses指定的6个原子的向量类之一。


作者(S)----------Author(s)----------


R Core; <code>transpose</code> option by
Christoph Buser, ETH Zurich



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

http://www.wotsit.org/; the optional header fields are ignored. See also http://en.wikipedia.org/wiki/Data_Interchange_Format.
&lsquo;Windows Data Interchange Format (DIF) data format&rsquo; as part of its WinFX system, which may or may not be compatible.

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

The R Data Import/Export manual.
R数据导入/导出手册。

scan, type.convert, read.fwf for reading fixed width formatted input; read.table; data.frame.
scan,type.convert,read.fwf读取固定宽度的格式输入;read.table;data.frame。


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


## read.DIF() needs transpose=TRUE for file exported from Excel[,#read.DIF()需要从Excel中导出的文件转= TRUE]
udir <- system.file("misc", package="utils")
dd <- read.DIF(file.path(udir, "exDIF.dif"), header= TRUE, transpose=TRUE)
dc <- read.csv(file.path(udir, "exDIF.csv"), header= TRUE)
stopifnot(identical(dd,dc), dim(dd) == c(4,2))

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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-1-24 15:17 , Processed in 0.029005 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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