Work with the ts format and Time Series Plots in Base R using AirPassengers, monthly airline passengers from 1949 to 1960.

The program reads a year between 1949 and 1960.

  1. Plot the whole series with plot(), with a title.
  2. Take that year's 12 months with window(AirPassengers, start = c(year, 1), end = c(year, 12)), and draw them over the full series in another colour with lines().
  3. Print the year's total, and the month (from month.abb) with the most passengers:
Total: 1520
Busiest month: Jul

Look at the plot: what two patterns do you see across the years, and how does the busiest month change?

Run draws your plot under the output. Check and Submit test the numbers your program prints.

You do not have permission to attempt this activity.