library(tidyr)
library(dplyr)
library(flextable)
example_data <- data.frame(Year = sample(2020:2023, 50, replace = TRUE),
A = sample(c("Type 1", "Type 2"), 50, replace = TRUE),
B = sample(c("Apples", "Oranges", "Bananas"), 50, replace = TRUE),
C = sample(c("Swedish", "Norwegian", "Chilean"), 50, replace = TRUE))
example_data |> select(B, A) |>
ftable(exclude=NULL) |>
data.frame() |>
spread(A, Freq) |>
regulartable() |>
ivo_flextable_theme()
Run the code above in your browser using DataLab