transpose_crosstable function

Transpose a crosstable

Transpose a crosstable

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

transpose_crosstable(x) ## S3 method for class 'crosstable' t(x)

Arguments

  • x: a crosstable

Returns

a tibble of class transposed_crosstable

Examples

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()