boxplotSPSS: Boxplots

Description Usage Arguments Value Author(s) Examples

View source: R/plots.R

Description

Draw boxplots of variables in a data frame, including boxplots for groups of observations and boxplots for separate variables. The plots thereby mimic the look of SPSS graphs.

Usage

1
2
3
4
5
6
7
8
9
boxplotSPSS(
  data,
  variables,
  group = NULL,
  xlab = NULL,
  ylab = NULL,
  cut.names = NULL,
  ...
)

Arguments

data

a data frame containing the variables to be plotted.

variables

a character vector specifying separate variables to be plotted. If group is not NULL, only the first variable is used and boxplots of groups of observations are drawn instead.

group

an character string specifying a grouping variable, or NULL for no grouping.

xlab, ylab

the axis labels.

cut.names

a logical indicating whether to cut long variable names or group labels to 8 characters. The default is TRUE for boxplots of separate variables, but FALSE for boxplots of groups of observations (which mimics SPSS behavior).

...

additional arguments to be passed down, in particular graphical parameters (see boxplot and par).

Value

A list containing summary statistics is returned invisibly (see boxplot).

Author(s)

Andreas Alfons

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## paired sample
# load data
data("Exams")

# plot grades on regular and resit exams
boxplotSPSS(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
boxplotSPSS(Eredivisie, "logMarketValue", group = "Foreign")

r2spss documentation built on Nov. 25, 2021, 1:06 a.m.