Description Usage Arguments Details Author(s) Examples
Generates a boxplot of a factor variable on one axis with raw values "jittered" as dots underneath the box.
1 | plotBoxWithJitter(data, x, y, groups = NULL)
|
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. |
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
).
Luke W. Johnston
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')
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.