Session Ready
Exercise

Combining xts by row with rbind

Now that you have merged data by column, you will be happy to know it's just as easy to add new rows to your data.

xts provides its own S3 method to the base rbind() generic function. The xts rbind function is much simpler than merge(). The only argument that matters is ..., which takes an arbitrary number of objects to bind. What is different is that rbind requires a time series, since we need to have timestamps for R to know where to insert new data.

For this exercise you will update your temps data with three new observations. One will be before the series started and two will be after. Pay attention to your function call, does order matter?

In your workspace, the objects temps, temps_june30, temps_july17 and temps_july18 are already loaded.

Instructions
100 XP
  • Bind the row from June 30th (temps_june30) to temps, and call this temps2.
  • Bind the rows from July 17th and 18th to temps2. Call this temps3.