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.40 |
1.50 |
0.20 |
5.40 |
3.90 |
1.30 |
0.40 |
|
versicolor |
6.30 |
2.30 |
4.40 |
1.30 |
5.10 |
2.50 |
3.00 |
1.10 |
|
virginica |
7.70 |
2.60 |
6.90 |
2.30 |
5.70 |
2.50 |
5.00 |
2.00 |
|
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.40 |
1.50 |
0.20 |
5.40 |
3.90 |
1.30 |
0.40 |
|
versicolor |
6.30 |
2.30 |
4.40 |
1.30 |
5.10 |
2.50 |
3.00 |
1.10 |
|
virginica |
7.70 |
2.60 |
6.90 |
2.30 |
5.70 |
2.50 |
5.00 |
2.00 |
|
iris2 %>%
make_pivot_table(col1 = Species, col2 = Species_random, theme = "tron")iris2 |
Species_random |
|
|||
setosa |
versicolor |
virginica |
|||
Species |
setosa |
17 |
18 |
15 |
33% (50) |
versicolor |
16 |
16 |
18 |
33% (50) |
|
virginica |
17 |
16 |
17 |
33% (50) |
|
|
33% (50) |
33% (50) |
33% (50) |
100% (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.40 |
1.50 |
0.20 |
5.40 |
3.90 |
1.30 |
0.40 |
|
versicolor |
6.30 |
2.30 |
4.40 |
1.30 |
5.10 |
2.50 |
3.00 |
1.10 |
|
virginica |
7.70 |
2.60 |
6.90 |
2.30 |
5.70 |
2.50 |
5.00 |
2.00 |
|
iris2 %>%
make_pivot_table(col1 = Species, col2 = Species_random, theme = "vanilla")iris2 |
Species_random |
|
|||
setosa |
versicolor |
virginica |
|||
Species |
setosa |
17 |
18 |
15 |
33% (50) |
versicolor |
16 |
16 |
18 |
33% (50) |
|
virginica |
17 |
16 |
17 |
33% (50) |
|
|
33% (50) |
33% (50) |
33% (50) |
100% (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.40 |
1.50 |
0.20 |
5.40 |
3.90 |
1.30 |
0.40 |
|
versicolor |
6.30 |
2.30 |
4.40 |
1.30 |
5.10 |
2.50 |
3.00 |
1.10 |
|
virginica |
7.70 |
2.60 |
6.90 |
2.30 |
5.70 |
2.50 |
5.00 |
2.00 |
|
iris1 %>%
make_flextable(header_words = header_words, last_id_col = 1, theme = "alafoli")Species |
Sepal |
Petal |
||
Length |
Width |
Length |
Width |
|
setosa |
5.00 |
3.40 |
1.50 |
0.20 |
5.40 |
3.90 |
1.30 |
0.40 |
|
versicolor |
6.30 |
2.30 |
4.40 |
1.30 |
5.10 |
2.50 |
3.00 |
1.10 |
|
virginica |
7.70 |
2.60 |
6.90 |
2.30 |
5.70 |
2.50 |
5.00 |
2.00 |
|