rogers1000 / cyclingchaos

Cycling Data Package
6 stars 0 forks source link

Pivot Results Table - Startlist Count not including DNFs #7

Closed rogers1000 closed 6 months ago

rogers1000 commented 6 months ago

results_pivot_gt <- results_pivot(2023,"Men","Rider","GC Time from Leader","Riders - 45992","","","")

Results for the code don't count LBL race where Pog crashed out towards count. Races Count is incorrect and is counting DNFs for Race Startlist

rogers1000 commented 6 months ago

Fixed issue. Was relating to a filter on startlist count which excluded non-finishers. Probably was an error thinking that it was about races_finished rather than races_started.

Code with error

  filter(position_edit_gc < 1000) |>
  group_by(pivot_id) |>
  summarise(races_count = n_distinct(paste0(first_cycling_race_id,"_",stage)))

Code without error:

results_pivot_races_count <- results_pivot_filters |>
  group_by(pivot_id) |>
  summarise(races_count = n_distinct(paste0(first_cycling_race_id,"_",stage)))