display_dist: display_dist

View source: R/display_dist.R

display_distR Documentation

display_dist

Description

Displays the approximate shape of a distribution in the console (or other i/o system) using Unicode Block Elements glyphs.

Usage

display_dist(x, width = 10)

Arguments

x

A numeric vector (double or integer).

width

The number of blocks comprising the printed distribution.

Details

display_dist() is motivated by precis::histospark() (Hadley Wickham) and rethinking::precis() (Richard McElreath). It displays a slightly more-granular distribution than those functions, and the peak(s) of the distribution is easily identified via the use of a distinctive Block Elements glyph.

Value

Console output.

Examples

# Normal
set.seed(99)
x <- rnorm(1000, 0, 1)
display_dist(x, 10)

# Poisson
set.seed(99)
x <- rpois(1000, lambda = 6)
display_dist(x, 10)


jacob-gg/manager documentation built on July 2, 2024, 2:09 a.m.