knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
Create tidyverse-friendly tables of frequencies
You can install tidytab from GitHub with:
# install.packages("devtools") devtools::install_github("gvelasq/tidytab")
library(tidytab) # one-way table of frequencies mtcars |> tab(cyl) # two-way table of frequencies (a special 2x2 contingency table) mtcars |> tab(cyl, gear) # flat contingency tables of three (or more) variables mtcars |> tab(cyl, gear, am) # tables wider than the R console are automatically wrapped mtcars |> tab(cyl, gear, am, vs) # missing values are displayed in red tab(letters[24:27]) # ftab() displays only flat contingency tables (here, with two variables) mtcars |> ftab(cyl, gear) # tab1() displays one-way tables for each variable mtcars |> tab1(cyl, gear) # tab2() displays two-way tables for all variable combinations mtcars |> tab2(cyl, gear, am) # ta() is a shortened alias for tab(), inspired by Stata mtcars |> ta(gear)
Please note that the tidytab project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.