Get startedGet started for free

Time series data workflow

1. Time series data workflow

The steps explored in this chapter, including merging by row and column and manipulating periodicity, are common tasks in time series data manipulation.

2. Workflow for merging

As you continue to master these tasks, you'll find that following a regular sequence can minimize unexpected errors. First, you should make sure every relevant data object is encoded as an xts object. The simple merging process demonstrated in this chapter depends on the time-based index contained in an xts object. Second, you should examine the periodicity of each object and, if necessary, adjust the periodicity prior to merging. While this step is not strictly necessary, merging by column may produce unexpected results if your xts objects do not share a common periodicity. For similar reasons, you may want to ensure that your xts objects cover similar time periods as well. Finally, once you are confident that your xts objects cover similar time periods at the same periodicity, merge the objects using the merge() command. To ensure the merge was a success, you should always examine your merged data using the head() or tail() commands or produce a quick time series plot from the data.

3. Let's practice!

In the next set of exercises, you'll use this basic workflow strategy to merge additional weather data into your xts objects. With these best practices in mind, manipulating and merging xts objects can be quick and easy!