Get startedGet started for free

Merging time series data by row

1. Merging time series data by row

One of the most useful features of working with xts objects is merging by row.

2. Merging using rbind()

When merging regular objects in R, you need to be careful to ensure the objects are in the right order. Because all xts objects are ordered by a universal time index, merged xts objects will automatically be ordered in time. This makes merging easy, provided the objects contain similar information. To combine two similar xts objects, you can simply use the rbind() command. The order of the objects listed in your call to rbind() makes no difference, because the rows in your merged object will be automatically ordered in time.

3. Weather data

In the previous chapter, you manipulated monthly time series data on flights arriving in Boston from 2010 through 2015 and identified some interesting trends. In this chapter, you'll explore some possible explanations for these trends by incorporating new data on Boston weather. As you work through this chapter, you’ll see what steps need to be taken to combine this information for further analysis.

4. Let's practice!

OK, let's get to work!