Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/gvelasq/tidytab

Create tidyverse-friendly tables of frequencies
https://github.com/gvelasq/tidytab

exploratory-data-analysis r tidy-table

Last synced: 3 months ago
JSON representation

Create tidyverse-friendly tables of frequencies

Awesome Lists containing this project

README

        

---
output: github_document
---

```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```

# tidytab

> Create tidyverse-friendly tables of frequencies

[![R-CMD-check](https://github.com/gvelasq/tidytab/actions/workflows/R-CMD-check.yaml/badge.svg?branch=main)](https://github.com/gvelasq/tidytab/actions/workflows/R-CMD-check.yaml)
[![Codecov test coverage](https://codecov.io/gh/gvelasq/tidytab/branch/main/graph/badge.svg)](https://codecov.io/gh/gvelasq/tidytab?branch=main)
[![CRAN status](https://www.r-pkg.org/badges/version/tidytab)](https://cran.r-project.org/package=tidytab)
[![R-universe status](https://gvelasq.r-universe.dev/badges/tidytab)](https://gvelasq.r-universe.dev/tidytab)
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)

## Installation

You can install tidytab from GitHub with:

```{r gh-installation, eval = FALSE}
# install.packages("devtools")
devtools::install_github("gvelasq/tidytab")
```

## Usage

```{r example, message = FALSE}
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)
```

## Code of Conduct

Please note that the tidytab project is released with a [Contributor Code of Conduct](https://gvelasq.github.io/tidytab/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.