plotBoxWithJitter: Jittered-dot boxplot

Description Usage Arguments Details Author(s) Examples

Description

Generates a boxplot of a factor variable on one axis with raw values "jittered" as dots underneath the box.

Usage

1
plotBoxWithJitter(data, x, y, groups = NULL)

Arguments

data

The dataset with the variables of interest

x

Variable for the x-axis

y

Variable for the y-axis

groups

Optional, split boxplots and jittered dots by group.

Details

This function is useful for exploring the distribution of a series of variables that share a common unit, such as kilogram. The values for each variable are plotted as jittered dots with a boxplot of the distribution layered on top of the dots. Can add axis labels, themes, etc, through ggplots interface (eg. ylab).

Author(s)

Luke W. Johnston

Examples

1
2
3
4
5
6
7
data(state)
cbind(state.region, state.x77) %>%
  as.data.frame() %>%
  mutate(Region = as.factor(state.region),
         MedianIncome = cut(Income, breaks = c(-Inf, median(Income), Inf),
                            labels = c('Lower', 'Higher'))) %>%
  plotBoxWithJitter(., 'Region', 'Population', groups = 'MedianIncome')

lwjohnst86/rstatsToolkit documentation built on May 21, 2019, 9:15 a.m.