janitor::tabyl (janitor::crosstab)

library(dplyr)
library(janitor)

mtcars %>% janitor::tabyl(am,vs)
 am  0 1
  0 12 7
  1  6 7
library(flextable)


mtcars %>% janitor::tabyl(am,vs, percent = 'col') %>% flextable() %>% theme_tron()
# Por linha
mtcars %>% janitor::tabyl(am,vs) %>%
  adorn_percentages("row") %>%
  adorn_pct_formatting(digits = 2) %>%
  adorn_ns() %>% flextable() %>% theme_tron()
# Por coluna
mtcars %>% janitor::tabyl(am,vs) %>%
     adorn_percentages("col") %>%
     adorn_pct_formatting(digits = 2) %>%
     adorn_ns() %>% 
     flextable() %>% theme_tron()

modelsummary::datasummary_crosstab

library(modelsummary)

# Por linha
datasummary_crosstab(am ~ vs, data = mtcars)
am 0 1 All
0 N 12 7 19
% row 63.2 36.8 100.0
1 N 6 7 13
% row 46.2 53.8 100.0
All N 18 14 32
% row 56.2 43.8 100.0
# Por coluna
datasummary_crosstab(am ~ vs,
                     statistic = 1 ~ Percent("col"),
                     data = mtcars)
am 0 1
0 % col 66.7 50.0
1 % col 33.3 50.0
All % col 100.0 100.0