Week 2

Goals

For this week, my goals were:

  1. To practice and develop my data visualisation skills by using a TidyTuesday dataset.
  2. To create a variety of plots and continue to familiarise myself with R.
  3. Successfully embed code chunks and plots into a published learning log.

The Dataset

  • This week I chose to use a dataset from TidyTuesday! From a few weeks ago, a dataset was released that related to Mario Kart which I found super interesting and fun! I decided to then create plots that graph the time differences between each track in Mario Kart.

Challenges

  • This week I came across a few challenges! From trying to download the Mario Kart data into the global environment, I discovered how finicky coding can be as I had to manually input the URL.
  • I also constantly ran into issues of missing a bracket or misspelling a word, which meant that some pieces of code were more time consuming to write than others.

Successes

  • However, after much googling, I was able create the graphs shown below!
  • My greatest success of this week was my persistence to figure out an error and to clarify processes. As I was unsure going into this week’s log, I am happy that I was able to figure out the code and end up understanding it!

My Coding Process and Graphs

library(tidytuesdayR)
library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.1 ──
## ✓ ggplot2 3.3.3     ✓ purrr   0.3.4
## ✓ tibble  3.1.2     ✓ dplyr   1.0.6
## ✓ tidyr   1.1.3     ✓ stringr 1.4.0
## ✓ readr   1.4.0     ✓ forcats 0.5.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()
records <-read.csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2021/2021-05-25/records.csv')
summary(records)
##     track               type             shortcut            player         
##  Length:2334        Length:2334        Length:2334        Length:2334       
##  Class :character   Class :character   Class :character   Class :character  
##  Mode  :character   Mode  :character   Mode  :character   Mode  :character  
##                                                                             
##                                                                             
##                                                                             
##  system_played          date           time_period             time       
##  Length:2334        Length:2334        Length:2334        Min.   : 14.59  
##  Class :character   Class :character   Class :character   1st Qu.: 39.03  
##  Mode  :character   Mode  :character   Mode  :character   Median : 86.19  
##                                                           Mean   : 90.62  
##                                                           3rd Qu.:120.16  
##                                                           Max.   :375.83  
##  record_duration 
##  Min.   :   0.0  
##  1st Qu.:   6.0  
##  Median :  51.0  
##  Mean   : 220.8  
##  3rd Qu.: 198.8  
##  Max.   :3659.0
ggplot(records) + geom_point(aes(x = track, y = time))

After creating a scatterplot, I thought that the data would be best suited using a boxplot:

ggplot(records) + geom_boxplot(aes(x = track, y = time))

I wasn’t a huge fan of how congested the x-axis was, so I decided to switch the axis to make it more clear!

ggplot(records) + geom_boxplot(aes(x = time, y = track))

I also added the variable ‘shortcut’, to show whether a track had a shortcut, and whether race time was affected by such shortcuts:

ggplot(records) + geom_boxplot(aes(x = time, y = track, fill = shortcut))

Next Steps

  • My next steps are to go through Danielle’s next modules about data wrangling, which I am curious to learn about!
  • As I struggled a bit this week, I will keep familiarising myself with R Markdown and R code so I can understand the processes better and that future use of these tools are easier!
  • I would also like to keep practicing using TidyTuesday datasets! They’re super interesting and a great way to keep practicing my data visualisation skills!

Meme of the Week