Learn R Programming

crosstable (version 0.8.0)

transpose_crosstable: Transpose a crosstable

Description

Pivot a crosstable so the label column is swapped with the by row. This requires the variable column to be the same for every data column, like when all columns are numeric of when all columns are factors with the same levels

Usage

transpose_crosstable(x)

# S3 method for crosstable t(x)

Value

a tibble of class transposed_crosstable

Arguments

x

a crosstable

Examples

Run this code
ct = crosstable(mtcars2, c(mpg, drat, wt, qsec), by=am)
ct %>% t() %>% as_flextable()
ct2 = crosstable(mtcars2, c(mpg, drat, wt, qsec), by=c(am, vs))
ct2 %>% t() %>% as_flextable()

Run the code above in your browser using DataLab