The R Project SVN R

Rev

Rev 75560 | Rev 77323 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 75560 Rev 76503
Line 1... Line 1...
1
% File src/library/graphics/man/boxplot.Rd
1
% File src/library/graphics/man/boxplot.Rd
2
% Part of the R package, https://www.R-project.org
2
% Part of the R package, https://www.R-project.org
3
% Copyright 1995-2018 R Core Team
3
% Copyright 1995-2019 R Core Team
4
% Distributed under GPL 2 or later
4
% Distributed under GPL 2 or later
5
 
5
 
6
\name{boxplot}
6
\name{boxplot}
7
\alias{boxplot}
7
\alias{boxplot}
8
\alias{boxplot.default}
8
\alias{boxplot.default}
Line 13... Line 13...
13
}
13
}
14
\usage{
14
\usage{
15
boxplot(x, \dots)
15
boxplot(x, \dots)
16
 
16
 
17
\method{boxplot}{formula}(formula, data = NULL, \dots, subset, na.action = NULL,
17
\method{boxplot}{formula}(formula, data = NULL, \dots, subset, na.action = NULL,
18
        xlab = paste(names(mf)[-response], collapse = " : "),
18
        xlab = mklab(y_var = horizontal),
19
        ylab = names(mf)[ response],
19
        ylab = mklab(y_var =!horizontal),
20
        add = FALSE, ann = !add,
20
        add = FALSE, ann = !add, horizontal = FALSE,
21
        drop = FALSE, sep = ".", lex.order = FALSE)
21
        drop = FALSE, sep = ".", lex.order = FALSE)
22
 
22
 
23
\method{boxplot}{default}(x, \dots, range = 1.5, width = NULL, varwidth = FALSE,
23
\method{boxplot}{default}(x, \dots, range = 1.5, width = NULL, varwidth = FALSE,
24
        notch = FALSE, outline = TRUE, names, plot = TRUE,
24
        notch = FALSE, outline = TRUE, names, plot = TRUE,
25
        border = par("fg"), col = NULL, log = "",
25
        border = par("fg"), col = NULL, log = "",
Line 155... Line 155...
155
  sets).
155
  sets).
156
}
156
}
157
\examples{
157
\examples{
158
## boxplot on a formula:
158
## boxplot on a formula:
159
boxplot(count ~ spray, data = InsectSprays, col = "lightgray")
159
boxplot(count ~ spray, data = InsectSprays, col = "lightgray")
160
# *add* notches (somewhat funny here):
160
# *add* notches (somewhat funny here <--> warning "notches .. outside hinges"):
161
boxplot(count ~ spray, data = InsectSprays,
161
boxplot(count ~ spray, data = InsectSprays,
162
        notch = TRUE, add = TRUE, col = "blue")
162
        notch = TRUE, add = TRUE, col = "blue")
163
 
163
 
-
 
164
boxplot(decrease ~ treatment, data = OrchardSprays, col = "bisque",
-
 
165
        log = "y")
-
 
166
## horizontal=TRUE, switching  y <--> x :
164
boxplot(decrease ~ treatment, data = OrchardSprays,
167
boxplot(decrease ~ treatment, data = OrchardSprays, col = "bisque",
165
        log = "y", col = "bisque")
168
        log = "x", horizontal=TRUE)
166
 
169
 
167
rb <- boxplot(decrease ~ treatment, data = OrchardSprays, col = "bisque")
170
rb <- boxplot(decrease ~ treatment, data = OrchardSprays, col = "bisque")
168
title("Comparing boxplot()s and non-robust mean +/- SD")
171
title("Comparing boxplot()s and non-robust mean +/- SD")
169
 
-
 
170
mn.t <- tapply(OrchardSprays$decrease, OrchardSprays$treatment, mean)
172
mn.t <- tapply(OrchardSprays$decrease, OrchardSprays$treatment, mean)
171
sd.t <- tapply(OrchardSprays$decrease, OrchardSprays$treatment, sd)
173
sd.t <- tapply(OrchardSprays$decrease, OrchardSprays$treatment, sd)
172
xi <- 0.3 + seq(rb$n)
174
xi <- 0.3 + seq(rb$n)
173
points(xi, mn.t, col = "orange", pch = 18)
175
points(xi, mn.t, col = "orange", pch = 18)
174
arrows(xi, mn.t - sd.t, xi, mn.t + sd.t,
176
arrows(xi, mn.t - sd.t, xi, mn.t + sd.t,