Base R Descriptive Stats

First, let’s find the minimum speed recorded and the maximum speed recorded during the fastest laps for each race. Since fastest lap time is a character we need to change it from a character to a numeric value and lets remove any NAs.

library(RandomData)
dat <- race_stats

# change NA to 0s and to numeric
dat$fastestLapSpeed <-as.numeric(
    ifelse(dat$fastestLapSpeed >= 0, dat$fastestLapSpeed, 0)
    )
mean(dat$fastestLapSpeed)
[1] 201.4552
median(dat$fastestLapSpeed)
[1] 203.003
quantile(dat$fastestLapSpeed, 0.25)
    25% 
191.142 
quantile(dat$fastestLapSpeed, 0.75)
    75% 
214.339 
IQR(dat$fastestLapSpeed)
[1] 23.197
sd(dat$fastestLapSpeed)
[1] 23.22281
var(dat$fastestLapSpeed)
[1] 539.2991