Expanding your data
Now that you have a handle on time series workflow, you're ready to assess the hypothesis that flight delays are a function of visibility and wind.
In this exercise, you'll add a few more columns to your xts object by merging data on monthly average visibility (vis
) and wind speeds (wind
) in the Boston area from 2010 through 2015. These data are derived from the same source as your temperature data, but have already been manipulated and converted to xts to make your job easier.
This is similar to what you've done before, but this time you have less prewritten code to work with. Your working xts object, flights_temps
, is also available in your workspace.
This exercise is part of the course
Case Study: Analyzing City Time Series Data in R
Exercise instructions
- Your first task, as always, is to confirm the periodicity and duration of your
vis
andwind
data by using two calls toperiodicity()
. - Once you have confirmed that the
vis
andwind
data have the same periodicity and duration as your existing data, usemerge()
to combine all three objects into a single xts object:flights_weather
. To keep things consistent, merge your data in the following order:flights_temps
,vis
,wind
. - Use
head()
to view the first few rows offlights_weather
and ensure your merge was successful.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Confirm the periodicity and duration of the vis and wind data
# Merge vis and wind with your existing flights_temps data
flights_weather <-
# View the first few rows of your flights_weather data