1. Learn
  2. /
  3. Courses
  4. /
  5. Manipulating Time Series Data in R

Exercise

Selecting a window from a time series

Real-life time series datasets can span decades, as in the case of long-term climate and meteorological studies, financial records, or stock market data. By creating a window from a time series, you can hone in on a specific region of important data or exclude parts of the data that may not be necessary to consider.

In this exercise, you'll select a window from the dow_jones time series, containing real-world stocks information from the Dow Jones Industrial Average – the stock prices from 30 major companies based in the United States.

The dow_jones dataset and the ggplot2, zoo, and lubridate packages are available to you.

Instructions

100 XP
  • Create a window from the dow_jones dataset which starts on January 1, 2019, and ends on January 1, 2021; assign this to dow_jones_window.

  • Generate an autoplot for the original dow_jones dataset with the y-axis label "Price (USD)".

  • Generate an autoplot for the dow_jones_window dataset with the y-axis label "Price (USD)".