-
Notifications
You must be signed in to change notification settings - Fork 6
/
README.Rmd
72 lines (51 loc) · 2.21 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{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
<!-- badges: start -->
[![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)
<!-- badges: end -->
## 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.