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.10 |
3.80 |
1.60 |
0.20 |
5.00 |
3.60 |
1.40 |
0.20 |
|
5.10 |
3.30 |
1.70 |
0.50 |
|
versicolor |
6.00 |
2.20 |
4.00 |
1.00 |
virginica |
5.80 |
2.70 |
5.10 |
1.90 |
6.50 |
3.20 |
5.10 |
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.10 |
3.80 |
1.60 |
0.20 |
5.00 |
3.60 |
1.40 |
0.20 |
|
5.10 |
3.30 |
1.70 |
0.50 |
|
versicolor |
6.00 |
2.20 |
4.00 |
1.00 |
virginica |
5.80 |
2.70 |
5.10 |
1.90 |
6.50 |
3.20 |
5.10 |
2.00 |
|
iris2 %>%
make_pivot_table(col1 = Species, col2 = Species_random, theme = "tron")iris2 |
Species_random |
|
|||
|---|---|---|---|---|---|
setosa |
versicolor |
virginica |
|||
Species |
setosa |
22 |
13 |
15 |
33% (50) |
versicolor |
14 |
19 |
17 |
33% (50) |
|
virginica |
14 |
18 |
18 |
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.10 |
3.80 |
1.60 |
0.20 |
5.00 |
3.60 |
1.40 |
0.20 |
|
5.10 |
3.30 |
1.70 |
0.50 |
|
versicolor |
6.00 |
2.20 |
4.00 |
1.00 |
virginica |
5.80 |
2.70 |
5.10 |
1.90 |
6.50 |
3.20 |
5.10 |
2.00 |
|
iris2 %>%
make_pivot_table(col1 = Species, col2 = Species_random, theme = "vanilla")iris2 |
Species_random |
|
|||
|---|---|---|---|---|---|
setosa |
versicolor |
virginica |
|||
Species |
setosa |
22 |
13 |
15 |
33% (50) |
versicolor |
14 |
19 |
17 |
33% (50) |
|
virginica |
14 |
18 |
18 |
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.10 |
3.80 |
1.60 |
0.20 |
5.00 |
3.60 |
1.40 |
0.20 |
|
5.10 |
3.30 |
1.70 |
0.50 |
|
versicolor |
6.00 |
2.20 |
4.00 |
1.00 |
virginica |
5.80 |
2.70 |
5.10 |
1.90 |
6.50 |
3.20 |
5.10 |
2.00 |
|
iris1 %>%
make_flextable(header_words = header_words, last_id_col = 1, theme = "alafoli")Species |
Sepal |
Petal |
||
|---|---|---|---|---|
Length |
Width |
Length |
Width |
|
setosa |
5.10 |
3.80 |
1.60 |
0.20 |
5.00 |
3.60 |
1.40 |
0.20 |
|
5.10 |
3.30 |
1.70 |
0.50 |
|
versicolor |
6.00 |
2.20 |
4.00 |
1.00 |
virginica |
5.80 |
2.70 |
5.10 |
1.90 |
6.50 |
3.20 |
5.10 |
2.00 |
|