Bắt đầu ngayBắt đầu miễn phí

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.

Bài tập này là một phần của khóa học

Case Study: Analyzing City Time Series Data in R

Xem khóa học

Hướng dẫn bài tập

  • Your first task, as always, is to confirm the periodicity and duration of your vis and wind data by using two calls to periodicity().
  • Once you have confirmed that the vis and wind data have the same periodicity and duration as your existing data, use merge() 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 of flights_weather and ensure your merge was successful.

Bài tập tương tác thực hành trực tiếp

Hãy thử làm bài tập này bằng cách hoàn thành đoạn mã mẫu này.

# 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
Chỉnh sửa và Chạy Mã