In Mario Kart 8 Deluxe on Switch, each character has its own set of statistics, but unlike karts and customization elements, they are not displayed directly on the screen.
Characters all have their own very precise statistics: speed (different according to the environment), maneuverability, power of mini-turbos, absolute speed, …
These parameters are rated out of 6 and have been listed by the community of fans of the game.
We will use flextable to present the detail of these statistics by characters.
library(magrittr)
library(flextable)
library(officer)
Data are available here: https://docs.google.com/spreadsheets/d/1g7A-38tn9UAIbB2B3sZI-MpILsS3ZS870UTVMRRxh4Q/edit#gid=0
mario_kart <- readxl::read_excel("mario-kart.xlsx", skip = 1)
mario_kart$image <- file.path("mario", paste0(mario_kart$image, ".png"))
mario_kart$star <- file.path("mario", mario_kart$star)
mario_kart
## # A tibble: 16 × 16
## Characters Land_speed `Anti-G_speed` Water_speed Gliding_speed Accel Weight
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 Baby Peach 2.25 2 2.5 2.75 4 2
## 2 Baby Rosali… 2.25 2 2.5 2.75 4.25 2
## 3 Baby Mario 2.5 2.25 2.75 3 4.25 2.25
## 4 Toadette 2.75 2.5 3 3.25 4.25 2.5
## 5 Koopa Troopa 2.75 2.5 3 3.25 4 2.5
## 6 Toad 3 2.75 3.25 3.5 4 2.75
## 7 Cat Peach 3.25 3 3.5 3.75 4 2.75
## 8 Peach 3.5 3.25 3.75 4 3.75 3
## 9 Tanooki Mar… 3.5 3.25 3.75 4 3.75 3.25
## 10 Mario 3.75 3.5 4 4.25 3.5 3.5
## 11 Luigi 3.75 3.5 4 4.25 3.5 3.5
## 12 Rosalina 4 3.75 4.25 4.5 3.25 3.75
## 13 Metal Mario 4.25 4 4.5 4.75 3.25 4.5
## 14 Waluigi 4.5 4.25 4.75 5 3.25 4
## 15 Wario 4.75 4.5 5 5.25 3 4.25
## 16 Bowser 4.75 4.5 5 5.25 3 4.5
## # … with 9 more variables: Land <dbl>, `Anti-G` <dbl>, Water <dbl>,
## # Gliding <dbl>, Traction <dbl>, `M-turbo` <dbl>, image <chr>, color <chr>,
## # star <chr>
fs::dir_tree("mario")
## mario
## ├── BebeHarmonie.png
## ├── BebeMario.png
## ├── BebePeach.png
## ├── Bowser.png
## ├── Harmonie.png
## ├── KoopaTroopa.png
## ├── Luigi.png
## ├── Mario.png
## ├── MarioMetal.png
## ├── Peach.png
## ├── PeachChat.png
## ├── Star_coin.png
## ├── Tanuki.png
## ├── Toad.png
## ├── Toadette.png
## ├── Waluigi.png
## └── Wario.png
set_flextable_defaults(font.family = "Arial", font.size = 9, padding = 2, digits = 1)
var_stat <- setdiff(names(mario_kart), c("image", "star", "color", "Characters"))
ft <- flextable(mario_kart, col_keys = c("Characters", var_stat)) %>%
set_header_labels(Land_speed = "Land", `Anti-G_speed` = "Anti-G",
Water_speed = "Water", Gliding_speed = "Gliding") %>%
add_header_row(values = c("Characters", "Speed", "Accel", "Weight",
"Handling", "Traction", "M-turbo"),
colwidths = c(1, 4, 1, 1,
4, 1, 1)) %>% theme_box() %>%
merge_v(part = "header") %>% bold(part = "header") %>%
valign(valign = "center", part = "header") %>%
compose(j = "Characters",
value = as_paragraph(
as_b(
colorize(Characters, color = mario_kart$color)),
as_chunk(" "),
as_image(image, width = 0.2, height = 0.2))
) %>%
colformat_double(digits = 1) %>%
theme_zebra(odd_header = "#c7254e", even_header = "#c7254e",
odd_body = "#fff5f5", even_body = "#f8f9fa") %>%
color(part = "header", color = "white") %>%
align(align = "right", part = "all") %>%
autofit()
ft
Characters | Speed | Accel | Weight | Handling | Traction | M-turbo | ||||||
Land | Anti-G | Water | Gliding | Land | Anti-G | Water | Gliding | |||||
Baby Peach | 2.2 | 2.0 | 2.5 | 2.8 | 4.0 | 2.0 | 5.0 | 5.0 | 4.5 | 5.0 | 4.2 | 4.0 |
Baby Rosalina | 2.2 | 2.0 | 2.5 | 2.8 | 4.2 | 2.0 | 4.8 | 4.8 | 4.2 | 4.8 | 3.8 | 4.0 |
Baby Mario | 2.5 | 2.2 | 2.8 | 3.0 | 4.2 | 2.2 | 4.5 | 4.5 | 4.0 | 4.5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 | 3.0 | 2.8 |
Let’s add the coin where a character has the hightest score.
for(column in var_stat){
i_selector <- as.formula(paste0("~`", column, "`>= max(`", column, "`, na.rm = TRUE)"))
ft <- compose(ft,
i = i_selector, j = column,
value = as_paragraph(
as_image(star, width = .15, height = .15),
as_chunk(" "),
as_chunk(.)), use_dot = TRUE
)
}
ft <- ft %>% autofit()
And the final result is:
ft
Characters | Speed | Accel | Weight | Handling | Traction | M-turbo | ||||||
Land | Anti-G | Water | Gliding | Land | Anti-G | Water | Gliding | |||||
Baby Peach | 2.2 | 2.0 | 2.5 | 2.8 | 4.0 | 2.0 | 5.0 | 5.0 | 4.5 | 5.0 | 4.2 | 4.0 |
Baby Rosalina | 2.2 | 2.0 | 2.5 | 2.8 | 4.2 | 2.0 | 4.8 | 4.8 | 4.2 | 4.8 | 3.8 | 4.0 |
Baby Mario | 2.5 | 2.2 | 2.8 | 3.0 | 4.2 | 2.2 | 4.5 | 4.5 | 4.0 | 4.5 | 4.0 | 3.8 |
Toadette | 2.8 | 2.5 | 3.0 | 3.2 | 4.2 | 2.5 | 4.2 | 4.2 | 3.8 | 4.2 | 3.5 | 3.8 |
Koopa Troopa | 2.8 | 2.5 | 3.0 | 3.2 | 4.0 | 2.5 | 4.5 | 4.5 | 4.0 | 4.5 | 4.2 | 3.8 |
Toad | 3.0 | 2.8 | 3.2 | 3.5 | 4.0 | 2.8 | 4.2 | 4.2 | 3.8 | 4.2 | 4.0 | 3.5 |
Cat Peach | 3.2 | 3.0 | 3.5 | 3.8 | 4.0 | 2.8 | 4.0 | 4.0 | 3.5 | 4.0 | 3.8 | 3.5 |
Peach | 3.5 | 3.2 | 3.8 | 4.0 | 3.8 | 3.0 | 3.8 | 3.8 | 3.2 | 3.8 | 3.8 | 3.5 |
Tanooki Mario | 3.5 | 3.2 | 3.8 | 4.0 | 3.8 | 3.2 | 3.8 | 3.8 | 3.2 | 3.8 | 3.2 | 3.5 |
Mario | 3.8 | 3.5 | 4.0 | 4.2 | 3.5 | 3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