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

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

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

                                        Box Plots
                                         箱线图

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

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

Produce box-and-whisker plot(s) of the given (grouped) values.
生产箱和须给定值(分组)图(S)。


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


boxplot(x, ...)

## S3 method for class 'formula'[类formula的方法]
boxplot(formula, data = NULL, ..., subset, na.action = NULL)

## Default S3 method:[默认方法]
boxplot(x, ..., range = 1.5, width = NULL, varwidth = FALSE,
        notch = FALSE, outline = TRUE, names, plot = TRUE,
        border = par("fg"), col = NULL, log = "",
        pars = list(boxwex = 0.8, staplewex = 0.5, outwex = 0.5),
        horizontal = FALSE, add = FALSE, at = NULL)



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

参数:formula
a formula, such as y ~ grp, where y is a numeric vector of data values to be split into groups according to the grouping variable grp (usually a factor).
如配方,y ~ grp,其中y是一个数字数据值向量分裂成组根据分组变量grp(通常是一个因素)。


参数:data
a data.frame (or list) from which the variables in formula should be taken.
数据框(或列表)变量formula应采取的。


参数:subset
an optional vector specifying a subset of observations to be used for plotting.
指定一个可选的向量绘图观测的子集。


参数:na.action
a function which indicates what should happen when the data contain NAs.  The default is to ignore missing values in either the response or the group.
一个函数,它表示数据时,包含NA的,应该发生什么。默认是忽略缺失值,无论是在响应或组。


参数:x
for specifying data from which the boxplots are to be produced. Either a numeric vector, or a single list containing such vectors. Additional unnamed arguments specify further data as separate vectors (each corresponding to a component boxplot). NAs are allowed in the data.
用于指定数据从生产的盒状图。无论是数字向量,或单一的列表,其中包含这样的向量。额外的未命名参数指定为独立的向量进一步的数据(每个对应一个组件盒形图)。 NAS在数据允许。


参数:...
For the formula method, named arguments to be passed to the default method.  For the default method, unnamed arguments are additional data vectors (unless x is a list when they are ignored), and named arguments are arguments and graphical parameters to be passed to bxp in addition to the ones given by argument pars (and override those in pars). Note that bxp may or may not make use of graphical parameters it is passed: see its documentation.  
对于formula方法,命名参数被传递到默认的方法。未命名参数为默认的方法,是额外的数据向量(除非x是当他们被忽略的列表),并命名参数参数及图形参数要传递中除了给出的bxp参数pars(和重写那些pars),。注意bxp可能会或可能不会做它是通过使用图形参数:看到它的文档。


参数:range
this determines how far the plot whiskers extend out from the box.  If range is positive, the whiskers extend to the most extreme data point which is no more than range times the interquartile range from the box. A value of zero causes the whiskers to extend to the data extremes.
这就决定了多远图胡须扩展开箱。 range如果是积极的,胡须扩展到最极端的数据点,这是没有比range倍,从包装盒中的四分位距。零值,使胡须扩展到数据极端。


参数:width
a vector giving the relative widths of the boxes making up the plot.
向量盒使图相对宽度。


参数:varwidth
if varwidth is TRUE, the boxes are drawn with widths proportional to the square-roots of the number of observations in the groups.
varwidth如果是TRUE,绘制的框宽度比例,以观察组方基层。


参数:notch
if notch is TRUE, a notch is drawn in each side of the boxes.  If the notches of two plots do not overlap this is "strong evidence" that the two medians differ (Chambers et al., 1983, p. 62).  See boxplot.stats for the calculations used.
如果notch是TRUE,在每个箱子的侧面绘制了一个档次。如果不重叠,两图的缺口,这是“强有力的证据”,两个位数不同(Chambers等人,1983年,P 62)。看到boxplot.stats计算使用。


参数:outline
if outline is not true, the outliers are not drawn (as points whereas S+ uses lines). </table>
outline如果是不正确的,离群不绘制(+使用线而点)。 </ TABLE>


参数:names
group labels which will be printed under each boxplot. Can be a character vector or an expression (see plotmath).
小组将根据每一个盒形图印标签。可以是一个字符向量或表达(见plotmath)。


参数:boxwex
a scale factor to be applied to all boxes.  When there are only a few groups, the appearance of the plot can be improved by making the boxes narrower.
规模因素将适用于所有框。当有只有少数群体,图的外观可以提高箱窄。


参数:staplewex
staple line width expansion, proportional to box width.
主食线宽扩展,框的宽度成正比。


参数:outwex
outlier line width expansion, proportional to box width.
离群线宽扩展,框的宽度成正比。


参数:plot
if TRUE (the default) then a boxplot is produced.  If not, the summaries which the boxplots are based on are returned.
如果TRUE(默认),那么一个盒形图产生。如果没有,返回的盒状图的基础上总结。


参数:border
an optional vector of colors for the outlines of the boxplots.  The values in border are recycled if the length of border is less than the number of plots.
可选颜色的盒状图的轮廓矢量。中的值border被回收,如果长度border是小于图。


参数:col
if col is non-null it is assumed to contain colors to be used to colour the bodies of the box plots. By default they are in the background colour.
col如果非空假设到包含要使用的颜色的方块图机构的色彩。默认情况下,他们中的背景颜色。


参数:log
character indicating if x or y or both coordinates should be plotted in log scale.
字符表示,如果X或Y或两个坐标应在数尺度绘制。


参数:pars
a list of (potentially many) more graphical parameters, e.g., boxwex or outpch; these are passed to bxp (if plot is true); for details, see there.
了许多潜在的图形参数,例如,boxwex或outpch名单;这些传递bxp(如果plot是真实的);详见。


参数:horizontal
logical indicating if the boxplots should be horizontal; default FALSE means vertical boxes.
逻辑指示的盒状图应该是横向的,默认的FALSE意味着垂直框。


参数:add
logical, if true add boxplot to current plot.
逻辑,如果真增加盒形图,以目前的图。


参数:at
numeric vector giving the locations where the boxplots should be drawn, particularly when add = TRUE; defaults to 1:n where n is the number of boxes.
数字向量的盒状图应绘制的位置,尤其是当add = TRUE;默认1:n其中n是箱数。


Details

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

The generic function boxplot currently has a default method (boxplot.default) and a formula interface (boxplot.formula).
通用功能boxplot目前有一个默认的方法(boxplot.default)和公式接口(boxplot.formula)。

If multiple groups are supplied either as multiple arguments or via a formula, parallel boxplots will be plotted, in the order of the arguments or the order of the levels of the factor (see factor).
如果有多个团体提供多个参数,或通过一个公式,平行的盒状图将绘制,参数的顺序或因子水平的顺序(见factor)。

Missing values are ignored when forming boxplots.
形成盒状图时,缺少的值将被忽略。


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

List with the following components:
名单由以下部分组成:


参数:stats
a matrix, each column contains the extreme of the lower whisker, the lower hinge, the median, the upper hinge and the extreme of the upper whisker for one group/plot.  If all the inputs have the same class attribute, so will this component.
一个矩阵,每一列包含晶须,较低的铰链,中位数,上铰链,并为一组/图上晶须极端的极端。如果所有的输入具有相同的阶级属性,将这个组件。


参数:n
a vector with the number of observations in each group.
观察各组的人数与向量。


参数:conf
a matrix where each column contains the lower and upper extremes of the notch.
一个矩阵,其中每一列包含缺口的下限和上限的极端。


参数:out
the values of any data points which lie beyond the extremes of the whiskers.
任何数据点在于超越胡须的极端值。


参数:group
a vector of the same length as out whose elements indicate to which group the outlier belongs.
out其元素表示离群属于哪个组的相同长度的向量。


参数:names
a vector of names for the groups.
一个团体的名称的向量。


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

The New S Language. Wadsworth &amp; Brooks/Cole.
Graphical Methods for Data Analysis.  Wadsworth &amp; Brooks/Cole.



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

boxplot.stats which does the computation, bxp for the plotting and more examples; and stripchart for an alternative (with small data sets).
boxplot.stats这计算,bxp策划和更多的例子;和stripchart替代(小数据集)。


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


## boxplot on a formula:[#箱线图上的一个公式:]
boxplot(count ~ spray, data = InsectSprays, col = "lightgray")
# *add* notches (somewhat funny here):[*加*缺口(有点滑稽):]
boxplot(count ~ spray, data = InsectSprays,
        notch = TRUE, add = TRUE, col = "blue")

boxplot(decrease ~ treatment, data = OrchardSprays,
        log = "y", col = "bisque")

rb <- boxplot(decrease ~ treatment, data = OrchardSprays, col="bisque")
title("Comparing boxplot()s and non-robust mean +/- SD")

mn.t <- tapply(OrchardSprays$decrease, OrchardSprays$treatment, mean)
sd.t <- tapply(OrchardSprays$decrease, OrchardSprays$treatment, sd)
xi <- 0.3 + seq(rb$n)
points(xi, mn.t, col = "orange", pch = 18)
arrows(xi, mn.t - sd.t, xi, mn.t + sd.t,
       code = 3, col = "pink", angle = 75, length = .1)

## boxplot on a matrix:[#箱线图上的矩阵:]
mat <- cbind(Uni05 = (1:100)/21, Norm = rnorm(100),
             `5T` = rt(100, df = 5), Gam2 = rgamma(100, shape = 2))
boxplot(as.data.frame(mat),
        main = "boxplot(as.data.frame(mat), main = ...)")
par(las=1)# all axis labels horizontal[所有水平轴标签]
boxplot(as.data.frame(mat), main = "boxplot(*, horizontal = TRUE)",
        horizontal = TRUE)

## Using 'at = ' and adding boxplots -- example idea by Roger Bivand :[#使用=,加入盒状图 - 由罗杰Bivand例如想法:]

boxplot(len ~ dose, data = ToothGrowth,
        boxwex = 0.25, at = 1:3 - 0.2,
        subset = supp == "VC", col = "yellow",
        main = "Guinea Pigs' Tooth Growth",
        xlab = "Vitamin C dose mg",
        ylab = "tooth length",
        xlim = c(0.5, 3.5), ylim = c(0, 35), yaxs = "i")
boxplot(len ~ dose, data = ToothGrowth, add = TRUE,
        boxwex = 0.25, at = 1:3 + 0.2,
        subset = supp == "OJ", col = "orange")
legend(2, 9, c("Ascorbic acid", "Orange juice"),
       fill = c("yellow", "orange"))

## more examples in  help(bxp)[#在帮助更多的例子(BXP)]

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


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

使用道具 举报

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

本版积分规则

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

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

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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