如何在 rmarkdown 中使用 janitor 和 kable 垂直拆分三向表
How to split vertically three-way tables using janitor and kable in rmarkdown
当我编织这两张桌子时,它们并排出现。
如何垂直拆分它们,每组一个 c
?
knitr::opts_chunk$set(echo = FALSE)
library(tidyverse)
library(janitor)
library(knitr)
df <- tibble(a = c(1, 2, 1, 2, 1, 2, 1, 2),
b = c(3, 3, 4, 3, 3, 3, 4, 4),
c = c(1, 1, 1, 1, 2, 2, 2, 2))
df %>% tabyl(a, b, c) %>%
adorn_totals(c("row", "col")) %>%
kable()
当我编织这两张桌子时,它们并排出现。
如何垂直拆分它们,每组一个 c
?
knitr::opts_chunk$set(echo = FALSE)
library(tidyverse)
library(janitor)
library(knitr)
df <- tibble(a = c(1, 2, 1, 2, 1, 2, 1, 2),
b = c(3, 3, 4, 3, 3, 3, 4, 4),
c = c(1, 1, 1, 1, 2, 2, 2, 2))
df %>% tabyl(a, b, c) %>%
adorn_totals(c("row", "col")) %>%
kable()