
Boxplot
is a wrapper for the standard R boxplot
function, providing point identification,
axis labels, and a formula interface for boxplots without a grouping variable.
Boxplot(y, ...)# S3 method for default
Boxplot(y, g, labels, id.method = c("y", "identify", "none"),
id.n=10, xlab, ylab, ...)
# S3 method for formula
Boxplot(formula, data = NULL, subset, na.action = NULL, labels.,
id.method = c("y", "identify", "none"), xlab, ylab, ...)
# S3 method for list
Boxplot(y, xlab="", ylab="", ...)
# S3 method for data.frame
Boxplot(y, labels=rownames(y), ...)
# S3 method for matrix
Boxplot(y, ...)
a numeric variable for which the boxplot is to be constructed; a list of numeric variables, each element of which will be treated as a group; a numeric data frame or a numeric matrix, each of whose columns will be treated as a group.
a grouping variable, usually a factor, for constructing parallel boxplots.
point labels; if not specified, Boxplot
will use the row names of the data
argument, if one is given, or observation numbers, or row names if y
is a data frame or matrix (that has row names).
if "y"
(the default), all outlying points are labeled; if "identify"
, points
may be labeled interactive; if "none"
, no point identification is performed.
up to id.n
high outliers and low outliers will be identified in each group, (default, 10).
text labels for the horizontal and vertical axes; if missing, Boxplot
will use the
variable names, or, in the case of a list, data frame, or matrix, empty labels.
a `model' formula, of the form ~ y
to produce a boxplot for the variable y
, or
of the form y ~ g
, y ~ g1*g2*...
, or y ~ g1 + g2 + ...
to
produce parallel boxplots for y
within levels of the grouping variable(s)
g
, etc., usually factors.
as for statistical modeling functions (see, e.g., lm
).
further arguments, such as at
, to be passed to boxplot
.
Fox, J. and Weisberg, S. (2011) An R Companion to Applied Regression, Second Edition, Sage.
Boxplot(~income, data=Prestige, id.n=Inf) # identify all outliers
Boxplot(income ~ type, data=Prestige)
Boxplot(income ~ type, data=Prestige, at=c(1, 3, 2))
Boxplot(k5 + k618 ~ lfp*wc, data=Mroz)
with(Prestige, Boxplot(income, labels=rownames(Prestige)))
with(Prestige, Boxplot(income, type, labels=rownames(Prestige)))
Boxplot(scale(Prestige[, 1:4]))
Run the code above in your browser using DataLab