Visualizing Boston winters
You discovered in the previous chapter that a much higher percentage of flights are delayed or cancelled in Boston during the winter. It seems logical that temperature is an important factor here. Perhaps colder temperatures are associated with a higher percentage of flight delays or cancellations?
In this exercise, you'll probe the plausibility of this hypothesis by plotting temperature trends over time and generating a visual overview of Boston winters.
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
Hướng dẫn bài tập
- Before plotting, check the periodicity and duration of your data using
periodicity(). Knowing the periodicity will help you interpret your data and will come in handy as you proceed. - Use
plot.xts()to generate a plot of mean Boston temperature (temps_xts$mean) for the duration of your data. - Generate another plot of mean Boston temperature from November 2010 through April 2011 (inclusive).
- Use
plot.zoo()to replicate your last plot while including the other columns in your data (in this case,minandmaxtemperature). Specifyplot.typeas"single"to include all three lines on the same panel. Do not change the prewrittenltyargument.
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.
# Identify the periodicity of temps_xts
# Generate a plot of mean Boston temperature for the duration of your data
plot.xts(___)
# Generate a plot of mean Boston temperature from November 2010 through April 2011
plot.xts(___["___/___"])
# Use plot.zoo to generate a single plot showing mean, max, and min temperatures during the same period
plot.zoo(___["___/___"], plot.type = "___", lty = lty)