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

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

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

                                        Flat Contingency Tables
                                         平面应变表

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

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

Create "flat" contingency tables.
创建“平面”的应急表。


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


ftable(x, ...)

## Default S3 method:[默认方法]
ftable(..., exclude = c(NA, NaN), row.vars = NULL,
       col.vars = NULL)



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

参数:x, ...
R objects which can be interpreted as factors (including character strings), or a list (or data frame) whose components can be so interpreted, or a contingency table object of class "table" or "ftable".
R,它可以解释因素(包括字符串),或列表(或数据框)的组件,可以这样解释或应急类"table"或"ftable"表对象的对象。


参数:exclude
values to use in the exclude argument of factor when interpreting non-factor objects.
值factor在解释非要素对象的排除参数在使用。


参数:row.vars
a vector of integers giving the numbers of the variables, or a character vector giving the names of the variables to be used for the rows of the flat contingency table.
给予的变量,或提供可用于平面应变表行的变量的名称字符向量的数量的整数向量。


参数:col.vars
a vector of integers giving the numbers of the variables, or a character vector giving the names of the variables to be used for the columns of the flat contingency table.
给变量或特征向量,平面应变表列中使用的变量的名称,数量的整数向量。


Details

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

ftable creates "flat" contingency tables.  Similar to the usual contingency tables, these contain the counts of each combination of the levels of the variables (factors) involved.  This information is then re-arranged as a matrix whose rows and columns correspond to unique combinations of the levels of the row and column variables (as specified by row.vars and col.vars, respectively).  The combinations are created by looping over the variables in reverse order (so that the levels of the left-most variable vary the slowest).  Displaying a contingency table in this flat matrix form (via print.ftable, the print method for objects of class "ftable") is often preferable to showing it as a higher-dimensional array.
ftable创建“平面”的应急表。类似平时的应急表,其中包含每个组合所涉及的变量(因素)的水平计数。然后将这些信息重新排列矩阵的行和列对应的行和列变量水平的独特组合(row.vars和col.vars,分别指定)。组合创建循环相反的顺序变量(最左边的变量的水平,使不同的最慢的)。类对象的打印方法的应变表显示在这个平坦的矩阵形式(通过print.ftable,"ftable")往往是可取的,以展示它作为一个高维数组。

ftable is a generic function.  Its default method, ftable.default, first creates a contingency table in array form from all arguments except row.vars and col.vars. If the first argument is of class "table", it represents a contingency table and is used as is; if it is a flat table of class "ftable", the information it contains is converted to the usual array representation using as.ftable.  Otherwise, the arguments should be R objects which can be interpreted as factors (including character strings), or a list (or data frame) whose components can be so interpreted, which are cross-tabulated using table. Then, the arguments row.vars and col.vars are used to collapse the contingency table into flat form.  If neither of these two is given, the last variable is used for the columns.  If both are given and their union is a proper subset of all variables involved, the other variables are summed out.
ftable是一个通用的功能。它的默认方法,ftable.default,首先创建一个数组中所有参数的形式,除了row.vars和col.vars应急表。如果第一个参数是类"table",它代表了一个应急表是用来作为;如果它是一类平面表"ftable",它包含的信息转换为通常的数组表示使用as.ftable。否则,参数应该是可以解释的因素(包括字符串),或一个列表(或数据框)的组件,可以这样解释,这是交叉表的使用tableR的对象。然后,参数row.vars和col.vars用于应急表折叠成扁平的形式。如果这两个都不是,最后一个变量用于列。如果两者都和他们的工会是正确的子集的所有涉及的变量,其它变量的总结。

When the arguments are R expressions interpreted as factors, additional arguments will be passed to table to control how the variable names are displayed; see the last example below.
当参数是因素解释ŕ表达,额外的参数将被传递到table控制如何显示变量名;看到下面的最后一个例子。

Function ftable.formula provides a formula method for creating flat contingency tables.
功能ftable.formula为创建平坦应急表提供了一个公式法。

There are methods for as.table and as.data.frame.
有方法as.table和as.data.frame。


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

ftable returns an object of class "ftable", which is a matrix with counts of each combination of the levels of variables with information on the names and levels of the (row and columns) variables stored as attributes "row.vars" and "col.vars".
ftable类"ftable",这是一个矩阵的每个变量的水平(行和列)的水平变量的名称和信息相结合的罪名返回一个对象存储属性"row.vars"和"col.vars"。


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

ftable.formula for the formula interface (which allows a data = . argument); read.ftable for information on reading, writing and coercing flat contingency tables; table for ordinary cross-tabulation; xtabs for formula-based cross-tabulation.
ftable.formula公式界面(允许data = .参数);read.ftable阅读,写作和胁迫的平面应变表的信息; table普通交叉制表; xtabs公式为基础的交叉制表。


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


## Start with a contingency table.[#启动了应急表。]
ftable(Titanic, row.vars = 1:3)
ftable(Titanic, row.vars = 1:2, col.vars = "Survived")
ftable(Titanic, row.vars = 2:1, col.vars = "Survived")

## Start with a data frame.[#启动一个数据框。]
x <- ftable(mtcars[c("cyl", "vs", "am", "gear")])
x
ftable(x, row.vars = c(2, 4))

## Start with expressions, use table()'s "dnn" to change labels[#开始表达,使用表()的“DNN”改变标签]
ftable(mtcars$cyl, mtcars$vs, mtcars$am, mtcars$gear, row.vars = c(2, 4),
       dnn = c("Cylinders", "V/S", "Transmission", "Gears"))

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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-1-22 22:49 , Processed in 0.030336 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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