Exercise

Extracting recurring intraday intervals

The most common time series data "in the wild" is daily. On occasion, you may find yourself working with intraday data, which contains both dates and times. In this case it is sometimes necessary to view only a subset of time for each day over multiple days. Using xts, you can slice days easily by using special notation in the i = argument to the single bracket extraction (i.e. [i, j]).

As you learned in the previous exercise, the trick to this is to not specify explicit dates, but rather to use the special T/T notation designed for intraday repeating intervals.

# Intraday times for all days
NYSE["T09:30/T16:00"] 

In this exercise, you will extract recurring morning hours from the time series irreg, which holds irregular data from the month of January 2010. Remember, you can always use the R console to experiment with irreg or to view the help pages with ?xts.

Instructions

100 XP
  • Using the irregular time series irreg, assign all observations between 8AM and 10AM to morn_2010.
  • Using morn_2010, extract only those observations from the morning of January 13th, 2010.