box_plot {r2spss} | R Documentation |
Box Plots
Description
Draw box plots of variables in a data frame, including box plots for groups of observations and box plots for separate variables. The plots thereby mimic the look of SPSS graphs.
Usage
box_plot(
data,
variables,
group = NULL,
cut.names = NULL,
style = c("T", "whiskers"),
coef = c(1.5, 3),
outlier.shape = c(1, 42),
version = r2spss_options$get("version"),
...
)
Arguments
data |
a data frame containing the variables to be plotted. |
variables |
a character vector specifying separate variables to be
plotted. If |
group |
an character string specifying a grouping variable, or
|
cut.names |
a logical indicating whether to cut long variable names or
group labels to 8 characters. The default is |
style |
a character string specifying the box plot style. Possible
values are |
coef |
a numeric vector of length 2 giving the multipliers of the interquartile range for determining intermediate and extreme outliers, respectively. |
outlier.shape |
an integer vector of length 2 giving the plot symbol for intermediate and extreme outliers, respectively. |
version |
a character string specifying whether the plot should mimic
the look of recent SPSS versions ( |
... |
additional arguments to be passed down, in particular
aesthetics (see |
Value
An object of class "ggplot"
, which produces
a box plot when printed.
Author(s)
Andreas Alfons
Examples
## paired sample
# load data
data("Exams")
# plot grades on regular and resit exams
box_plot(Exams, c("Regular", "Resit"))
## independent samples
# load data
data("Eredivisie")
# log-transform market values
Eredivisie$logMarketValue <- log(Eredivisie$MarketValue)
# plot log market values of Dutch and Foreign players
box_plot(Eredivisie, "logMarketValue", group = "Foreign")