Skip to contents

driversbr loads a tibble dataset with 106,078 rows and 7 columns:

library(driversbr)
library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
# grouping and translating
grouped_drivers <-
  drivers |> 
  summarise(.by = ano, x = sum(condutores, na.rm = T)) |> 
  rename(year = ano, drivers = x)

# plotting
plot(grouped_drivers$year, grouped_drivers$drivers,
     xlab = "Year", ylab = "Amount of Drivers")