Skip to contents

Create a histogram paired with a box plot.

Usage

num_dist_by_cat(
  num,
  group,
  data,
  title_hist = "",
  title_boxplot = "",
  lab_num = "",
  lab_group = "",
  num_on_x = TRUE,
  stat = TRUE
)

Arguments

num

Name of the column for the numeric variable.

group

Name of the column for the categorical variable.

data

Target data frame for visualization.

title_hist

Title for the histogram.

title_boxplot

Title for the boxplot.

lab_num

Axis label for the numeric variable.

lab_group

Axis label for the categorical variable.

num_on_x

Whether the numeric variable is put on the x-axis in the boxplot.

stat

Whether printing the test statistic and summary or not.

Value

A ggplot object consists of a histogram and a boxplot. @examples data <- data.frame( num = c( 1, 2, 3, 4), classes = c( 1, 1, 2, 2)) num_dist_by_cat( num = num, group = classes, data = data, title_hist = 'Distribution of X', title_boxplot = 'X Seperated by Group', lab_num = 'X', lab_group = 'Group', num_on_x = TRUE, stat = TRUE)