3-2-1 Mario Kart! #TidyTuesday Unfiltered

Is Rainbow Road actually challenging? Or does it just have a reputation of being challenging?

By Jesse Mostipak in tutorial

May 24, 2021

At my first data science job I worked with a guy who would throw his hands up and shout “We did it, Reddit!” any time something went really well. And last night was a huge “We did it, Reddit!” moment for me, and I hope for many of you as well.

My goal with streaming #TidyTuesday Unfiltered is to show what it’s like to work with an unfamiliar dataset, make mistakes in front of others, learn on the fly, and build a sense of community while also creating beginner-friendly content. You can check out the inaugural stream here.

Looking to skip past the 90 minutes of cats and conversation and dive right into creating our boxplot? I’ve got you covered. Here’s a 10-minute video walking through the code:

And the code!

set up our environment

library(tidyverse)
library(skimr)

data import

tuesdata <- tidytuesdayR::tt_load('2021-05-25')
records <- tuesdata$records

initial exploration of dataset

glimpse(records)

records %>% 
  skim()

records_tt <- records %>% 
  mutate(track = factor(track))
glimpse(records_tt)

let’s create our initial boxplot

records_tt %>% 
  ggplot(aes(x = track, y = record_duration)) +
  geom_boxplot()

add alpha 0.6 to geom_boxplot, swap x and y variables

records_tt %>% 
  ggplot(aes(x = record_duration, y = track)) +
  geom_boxplot(alpha = 0.6)

add a fill, where fill = type in aes() so we can see single vs triple laps

records_tt %>% 
  ggplot(aes(x = record_duration, y = track, fill = type)) +
  geom_boxplot(alpha = 0.6)
ggsave("25-05-2021_mario_kart.png", last_plot(), device = "png")

What is #TidyTuesday?

The #TidyTuesday project is a weekly data visualization challenge that asks community members to take a dataset, tidy it as needed, and create code and visualizations to share on Twitter. The visualizations are phenomenal and well worth perusing each week.

Photo by Ravi Palwe on Unsplash

Posted on:
May 24, 2021
Length:
2 minute read, 291 words
Categories:
tutorial
Tags:
R streaming boxplot Mario Kart
See Also:
A Slack-ers Guide to Twitch Streams
Stream makes a streamplot
"Master" of string manipulation