knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.width = 8, fig.height = 4.5, fig.align = 'center', out.width = '95%', dpi = 100, message = FALSE, warning = FALSE )
library(TidyDensity)
This is a basic example which shows you how easy it is to generate data with {TidyDensity}
:
library(TidyDensity) library(dplyr) library(ggplot2) tidy_normal()
An example plot of the tidy_normal
data.
tn <- tidy_normal(.n = 100, .num_sims = 6) tidy_autoplot(tn, .plot_type = "density") tidy_autoplot(tn, .plot_type = "quantile") tidy_autoplot(tn, .plot_type = "probability") tidy_autoplot(tn, .plot_type = "qq")
We can also take a look at the plots when the number of simulations is greater than nine. This will automatically turn off the legend as it will become too noisy.
tn <- tidy_normal(.n = 100, .num_sims = 20) tidy_autoplot(tn, .plot_type = "density") tidy_autoplot(tn, .plot_type = "quantile") tidy_autoplot(tn, .plot_type = "probability") tidy_autoplot(tn, .plot_type = "qq")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.