add_n: add number of cases

Description Usage Arguments References Examples

View source: R/add_n.R

Description

Add number of cases in box plot

Usage

1
2
3
4
5
6
add_n(
  y.fun = median,
  vjust = -0.3,
  position = position_dodge(width = 0.75),
  na.rm = T
)

Arguments

y.fun

function that calculate position in y-axis

vjust, position, na.rm

refer to stat_summary

References

https://stackoverflow.com/questions/28846348/add-number-of-observations-per-group-in-ggplot2-boxplot

Examples

1
2
3
4
tibble(x = gl(2, 50), y= rnorm(100)) %>% 
  ggplot(aes(x, y)) + 
  geom_boxplot() + 
  add_n()

Rundmus/Useful2me-R_package documentation built on Nov. 13, 2020, 4:16 p.m.