This mini-analysis uses a current snapshot of NFL quarterback passing leaders. I start from a single-stat leaderboard, intentionally reshape it into a wide layout to simulate a common “wide” data scenario, then tidy it back to long with tidyr. I summarize who leads in passing yards and provide a brief interpretation. The main goal is to demonstrate correct wide→tidy transformations and produce readable, publication-quality output.
# A tibble: 5 × 5
player team stat yards asOfDate
<chr> <chr> <chr> <dbl> <date>
1 Sam Darnold SEA Passing Yards 905 2025-09-28
2 Justin Herbert LAC Passing Yards 860 2025-09-28
3 Geno Smith LV Passing Yards 831 2025-09-28
4 Daniel Jones IND Passing Yards 816 2025-09-28
5 Dak Prescott DAL Passing Yards 800 2025-09-28
# Save outputs for your project folderwrite_csv(qbWide, "qb_passing_wide.csv")write_csv(qbLong, "qb_passing_tidy.csv")
#Data import and cleanup
I read in the CSV of the top five NFL quarterbacks by passing yards. I renamed value to yards and kept only the needed columns (player, team, stat, yards, asOfDate) to make the dataset clearer and easier to analyze.
#Wide format
I reshaped the tidy table into wide form with pivot_wider(), creating one row per stat and one column per player. This demonstrates how data can be stored in a less analysis-friendly format.
#Back to tidy
I then used pivot_longer() to return the data to tidy form, with each row showing one player’s passing yards. I rejoined the team and date fields so the dataset was complete.
#Analysis
From the tidy data I identified the leader in yards and calculated summary statistics (average, max, min, spread).
#Conclusion The current leader holds the highest passing yardage in this snapshot. The remaining players are relatively close, with an average in the low-to-mid 800s and a modest spread from first to fifth.