display_dist | R Documentation |
Displays the approximate shape of a distribution in the console (or other i/o system) using Unicode Block Elements glyphs.
display_dist(x, width = 10)
x |
A numeric vector (double or integer). |
width |
The number of blocks comprising the printed distribution. |
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.
Console output.
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.