Created
February 6, 2020 04:22
-
-
Save SaranjeetKaur/b6098e9b617f918f2ed13000a90d359d to your computer and use it in GitHub Desktop.
Code for TidyTuesday week 6 (NFL attendance)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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