Skip to content

Instantly share code, notes, and snippets.

@SaranjeetKaur
Created February 6, 2020 04:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SaranjeetKaur/b6098e9b617f918f2ed13000a90d359d to your computer and use it in GitHub Desktop.
Save SaranjeetKaur/b6098e9b617f918f2ed13000a90d359d to your computer and use it in GitHub Desktop.
Code for TidyTuesday week 6 (NFL attendance)
install.packages("tidyverse")
library("tidyverse")
attendance <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2020/2020-02-04/attendance.csv')
standings <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2020/2020-02-04/standings.csv')
games <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2020/2020-02-04/games.csv')
attendance <- na.omit(attendance)
attendance_arizona <- subset(attendance, attendance$team == "Arizona")
arizona_weekly <- ggplot2::ggplot(data = attendance_arizona, aes(x = year, y = weekly_attendance, colour = week)) +
geom_point() +
labs(x = 'Year', y = 'Weekly Attendance', title = 'Weekly attendance in team Arizona from 2000 to 2019')
arizona_weekly
arizona_team <- ggplot2::ggplot(data = attendance_arizona, aes(x = year, y = weekly_attendance, colour = team_name)) +
geom_point() +
labs(x = 'Year', y = 'Weekly Attendance', title = 'Team attendance in team Arizona from 2000 to 2019')
arizona_team
total <- ggplot2::ggplot(data = attendance, aes(x = year, y = total, colour = team_name)) +
geom_point() +
labs(x = 'Year', y = 'Total', title = 'NFL Teamwise total from 2000 to 2019')
total
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment