#Assignment 6
Welcome to my final assignment for the semester. This document will highlight my abilities on scraping data from a web source.
The following packages were used in this file: ddplyr XML httr and rvest
These packages will help me scrape the pages and articulate my findings.
I wanted to explore data related to baseball since that is my favorite sport and quarantine has stopped the start of the MLB season.
The web page I explored was the Cleveland Indians Wikipedia site. I noticed that there was data on the site related to attendence in stadiums. I wanted to see which year had the highest attendence since they renamed the stadium from Jacobs field to Progressive field. I also wanted to see if the trends in attendence and see if they correlate with wins and losses.
The module below highlights the 4 column heads I looked at to find the data tables. And how I cleaned my data. When I downloaded the data, it added a few rows before the column headers. I removed these rows and then changed the data types to numbers. I also removed all the commas in the larger numbers and removed the endings to the rankings.
Note: When I looked at these rankings, all had an ending of “th”. If there were endings with “rd” I would have to do a similar fix.
## [1] "Cleveland Indians"
## [1] 44
The three charts below show that: 1. League rank increases as the average game attendence increases. This is obvious, but shows that the data has no anomalies. 2. This shows that the average attendance was just over 20K people. 3. This shows that the average ranking was around 13 over the past 10 seasons.
Based on the charts below, We can see that the Indiands attendence started to decrease duing the earlt 2010’s. At this time, there record was very bad and it showed in their attendence. As they started to play better and become more of a factor in the division (2015 on), their attendance increased.
The other chart shows that there was a correlation with their league attendence and their record as well. It is interesting to see that a small market team like the Indians still hung around the middle of attendence for the league even when they were bad.
I think this shows that the Indians have loyal fans and will show up for the team wether they are doing well or poorly
I hope you enjoyed my analysis!