knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%", message = FALSE, warning = FALSE )
The goal of {TidyDensity}
is to make working with random numbers from different
distributions easy. All tidy_
distribution functions provide the following
components:
r_
]d_
]q_
]p_
]You can install the released version of {TidyDensity}
from CRAN with:
install.packages("TidyDensity")
And the development version from GitHub with:
# install.packages("devtools") devtools::install_github("spsanderson/TidyDensity")
This is a basic example which shows you how to solve a common problem:
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.