knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
The goal of statsummary is to compute summary statistics (mean, median, minimum, maximum, count) on a numeric variable grouped by a categorical variable.
statsummary is not yet on CRAN. You can install the development version of statsummary like so:
devtools::install_github("eamutaigwe/statsummary")
Summarize_data() is a function that helps to carry out a fairly common task on a dataset which quickly computes summary statistics (mean, median, minimum, maximum, and count) on a numeric variable grouped by a categorical variable.
It produces a list object with two items- a tibble or data frame containing summary statistics on a numeric variable grouped by a categorical variable, and a ggplot object- a boxplot which visually presents some of the summary statistics found in the summary table generated such as median, minimum, maximum, and count.
Below is a basic example which shows you how to use the function:
library(statsummary) summarize_data(gapminder::gapminder, continent, lifeExp)
summarize_data() is designed to always group by a categorical variable. So, if you decide to group by a numeric variable, it would throw an error. An error message is also returned if your y
variable is categorical.
summarize_data(gapminder::gapminder, gdpPercap, lifeExp)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.