Session Ready
Exercise

Merging across different frequencies

When merging datasets measured at different frequencies, you may need to generate a lower-frequency representation to use as a join key. For example, if you have daily data and monthly data, to combine them together you will probably want to generate a monthly aggregation of the underlying daily data.

Two datasets have been added to your session. dailyDT has daily observations of an exchange rate. monthlyDT has monthly total exports. The lubridate library has also been made available.

Instructions 1/3
undefined XP
  • 1
  • 2
  • 3
  • Add a new column called "yearmonth" to fxDT and exportDT, combining the year and month of each timestamp, separated by an underscore.