Viewing sports trends
Now that you've manipulated and subsetted your sports data in a number of ways, it's time to step back and consider some trends in the data. The plot on the right shows the cumulative win/loss averages of the Boston Red Sox in the 2015 MLB season and the Boston Bruins in the 2015-2016 NHL season.
Which team had the highest win/loss average at the end of their respective season?
Two xts objects, redsox_2015
and bruins_2015
are available in your workspace. These objects contain the dates of each game played in each season, along with the cumulative win/loss average as of each game (stored in the win_loss
column of each object). You can explore these objects using commands such as summary()
, structure()
, periodicity()
, head()
, or tail()
, or by subsetting.
This exercise is part of the course
Case Study: Analyzing City Time Series Data in R
Hands-on interactive exercise
Turn theory into action with one of our interactive exercises
