Session Ready
Exercise

Find the number of periods in your data

Often it is handy to know not just the range of your time series index, but also how many discrete irregular periods your time series data covers. You shouldn't be surprised to learn that xts provides a set of functions to do just that!

If you have a time series, it is now easy to see how many days, weeks or years your data contains. To do so, simply use the function ndays() and its shortcut functions nmonths(), nquarters(), and so forth, making counting irregular periods easy.

Instructions
100 XP
  • Count the months in edhec.
  • Count the quarters in edhec.
  • Count the years in edhec.