View source: R/stem_leaf_display.R
stem_leaf_display | R Documentation |
Function is a wrapper around aplpack::stem.leaf
that provides one or more stem and leaf display(s).
Function accepts a named list of numeric vectors from which stem and leaf displays are provided.
stem_leaf_display(
x = NULL,
title = NULL,
unit = 1,
m = 1,
min_val = NULL,
max_val = NULL,
outliers = TRUE,
depths = FALSE,
col_width = 4,
row_height = 0.5,
font_sz = 11,
heading_color = "black"
)
x |
The named list of numeric vectors from which stem and leaf displays are provided. |
title |
A string that sets the title. |
unit |
Leaf unit, as a power of 10 (e.g. 100, 0.01). The default is 1. |
m |
Number of parts (1, 2, 5) into which each stem will be separated. The default is 1. |
min_val |
Optional numeric that sets the smallest non-outlying value. |
max_val |
Optional numeric that sets the largest non-outlying value. |
outliers |
A logical which if |
depths |
A logical which if |
col_width |
A numeric that sets the display column widths in cm. The default is 4, which
works when 'depths' is |
row_height |
A numeric that sets the display row height in cm. The default is 0.5. You may need to decrease this value for smaller font sizes and longer stem values. |
font_sz |
A numeric that sets the display's font size. The default is 11. |
heading_color |
A string that sets the heading's color in name or hex. The default is "black". |
A ggplot2 class object
library(grid)
library(gtable)
library(ggplotify)
library(ggplot2)
library(aplpack)
library(RplotterPkg)
# stem and leaf for marathon times of women across ages
marathon_times_lst <- list(
"age_20" = RplotterPkg::boston_marathon[age == 20,]$time,
"age_30" = RplotterPkg::boston_marathon[age == 30,]$time,
"age_40" = RplotterPkg::boston_marathon[age == 40,]$time,
"age_50" = RplotterPkg::boston_marathon[age == 50,]$time,
"age_60" = RplotterPkg::boston_marathon[age == 60,]$time
)
# display stem and leaf of women times across ages
RplotterPkg::stem_leaf_display(
x = marathon_times_lst,
title = "Women times(min) in Boston marathon",
heading_color = "#FF5500"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.