Learn R Programming

daltoolbox (version 1.2.747)

plot_boxplot_class: Boxplot per class

Description

Boxplots of a numeric column grouped by a class label.

Usage

plot_boxplot_class(
  data,
  class_label,
  label_x = "",
  label_y = "",
  colors = NULL
)

Value

returns a ggplot2::ggplot graphic

Arguments

data

data.frame with a grouping column and one numeric column

class_label

name of the grouping (class) column

label_x

x‑axis label

label_y

y‑axis label

colors

optional fill color for the boxes

Details

Expects a data.frame with the grouping column named in class_label and one numeric column. The function melts to long format and draws per‑group distributions.

Examples

Run this code
grf <- plot_boxplot_class(iris |> dplyr::select(Sepal.Width, Species),
class_label = "Species", colors=c("red", "green", "blue"))
plot(grf)

Run the code above in your browser using DataLab