histogram_by_group: Histogram by group

Description Usage Arguments Value Examples

View source: R/histogram_by_group.R

Description

Creates histograms by group to compare distributions

Usage

1
2
3
4
5
6
7
8
histogram_by_group(
  data = NULL,
  iv_name = NULL,
  dv_name = NULL,
  order_of_groups_top_to_bot = NULL,
  number_of_bins = 40,
  space_between_histograms = 0.15
)

Arguments

data

a data object (a data frame or a data.table)

iv_name

name of the independent variable

dv_name

name of the dependent variable

order_of_groups_top_to_bot

a character vector indicating the desired presentation order of levels in the independent variable (from the top to bottom). Omitting a group in this argument will remove the group in the set of histograms.

number_of_bins

number of bins for the histograms (default = 40)

space_between_histograms

space between histograms (minimum = 0, maximum = 1, default = 0.15)

Value

a ggplot object

Examples

1
2
3
4
histogram_by_group(data = mtcars, iv_name = "cyl", dv_name = "mpg")
histogram_by_group(data = mtcars, iv_name = "cyl", dv_name = "mpg",
order_of_groups_top_to_bot = c("8", "4"), number_of_bins = 10,
space_between_histograms = 0.5)

ezr documentation built on Nov. 25, 2020, 5:09 p.m.