library(presenter)
library(dplyr)
iris %>% 
  sample_n(10) %>% 
  relocate(Species) %>% 
  head %>% 
  arrange(Species) -> iris1
iris %>% 
  mutate(Species_random = sample(Species)) -> iris2
header_words <- c("Sepal", "Petal")default theme
iris1 %>% 
  make_flextable(header_words = header_words, last_id_col = 1)| Species | Sepal | Petal | ||
|---|---|---|---|---|
| Length | Width | Length | Width | |
| setosa | 5.00 | 3.30 | 1.40 | 0.20 | 
| versicolor | 6.10 | 3.00 | 4.60 | 1.40 | 
| virginica | 5.60 | 2.80 | 4.90 | 2.00 | 
| 6.40 | 3.10 | 5.50 | 1.80 | |
| 6.90 | 3.10 | 5.40 | 2.10 | |
| 7.20 | 3.20 | 6.00 | 1.80 | |
iris1 %>% 
  make_flextable(header_words = header_words, last_id_col = 1, theme = "zebra_gold")| Species | Sepal | Petal | ||
|---|---|---|---|---|
| Length | Width | Length | Width | |
| setosa | 5.00 | 3.30 | 1.40 | 0.20 | 
| versicolor | 6.10 | 3.00 | 4.60 | 1.40 | 
| virginica | 5.60 | 2.80 | 4.90 | 2.00 | 
| 6.40 | 3.10 | 5.50 | 1.80 | |
| 6.90 | 3.10 | 5.40 | 2.10 | |
| 7.20 | 3.20 | 6.00 | 1.80 | |
iris2 %>% 
  make_pivot_table(col1 = Species, col2 = Species_random, theme = "tron")| iris2 | Species_random | 
 | |||
|---|---|---|---|---|---|
| setosa | versicolor | virginica | |||
| Species | setosa | 15 | 15 | 20 | 33% (50) | 
| versicolor | 16 | 14 | 20 | 33% (50) | |
| virginica | 19 | 21 | 10 | 33% (50) | |
| 
 | 33% (50) | 33% (50) | 33% (50) | 1 (150) | |
iris1 %>% 
  make_flextable(header_words = header_words, last_id_col = 1, theme = "vader")| Species | Sepal | Petal | ||
|---|---|---|---|---|
| Length | Width | Length | Width | |
| setosa | 5.00 | 3.30 | 1.40 | 0.20 | 
| versicolor | 6.10 | 3.00 | 4.60 | 1.40 | 
| virginica | 5.60 | 2.80 | 4.90 | 2.00 | 
| 6.40 | 3.10 | 5.50 | 1.80 | |
| 6.90 | 3.10 | 5.40 | 2.10 | |
| 7.20 | 3.20 | 6.00 | 1.80 | |
iris2 %>% 
  make_pivot_table(col1 = Species, col2 = Species_random, theme = "vanilla")| iris2 | Species_random | 
 | |||
|---|---|---|---|---|---|
| setosa | versicolor | virginica | |||
| Species | setosa | 15 | 15 | 20 | 33% (50) | 
| versicolor | 16 | 14 | 20 | 33% (50) | |
| virginica | 19 | 21 | 10 | 33% (50) | |
| 
 | 33% (50) | 33% (50) | 33% (50) | 1 (150) | |
iris1 %>% 
  make_flextable(header_words = header_words, last_id_col = 1, theme = "booktabs")| Species | Sepal | Petal | ||
|---|---|---|---|---|
| Length | Width | Length | Width | |
| setosa | 5.00 | 3.30 | 1.40 | 0.20 | 
| versicolor | 6.10 | 3.00 | 4.60 | 1.40 | 
| virginica | 5.60 | 2.80 | 4.90 | 2.00 | 
| 6.40 | 3.10 | 5.50 | 1.80 | |
| 6.90 | 3.10 | 5.40 | 2.10 | |
| 7.20 | 3.20 | 6.00 | 1.80 | |
iris1 %>% 
  make_flextable(header_words = header_words, last_id_col = 1, theme = "alafoli")| Species | Sepal | Petal | ||
|---|---|---|---|---|
| Length | Width | Length | Width | |
| setosa | 5.00 | 3.30 | 1.40 | 0.20 | 
| versicolor | 6.10 | 3.00 | 4.60 | 1.40 | 
| virginica | 5.60 | 2.80 | 4.90 | 2.00 | 
| 6.40 | 3.10 | 5.50 | 1.80 | |
| 6.90 | 3.10 | 5.40 | 2.10 | |
| 7.20 | 3.20 | 6.00 | 1.80 | |