Highlighting time series data
How did the Housing Price Index (HPI) change from 2000 to 2017 in the United States? In chapter 1 you created a basic time series plot that could start your investigation, but the inability to highlight an individual states' data was limiting. In this exercise, your task is to enable highlighting by state and investigate which states experienced the largest changes in HPI after the recession that started in December 2007.
plotly
and crosstalk
have already been loaded, and the code used to previously create the time series plot is shown.
Diese Übung ist Teil des Kurses
Intermediate Interactive Data Visualization with plotly in R
Anleitung zur Übung
- Create a
SharedData
object to enable the selection of an individual states' data. - Complete the plotting pipeline to create a time series plot of
house_price
againstyear
bystate
.
Interaktive Übung
Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.
# Create a shared data object keyed by individual states
state_data <- us_economy %>%
___$___(___)
# Using the shared data, plot house price vs. year
state_data %>%
___ %>%
# Group by state
___ %>%
# Add lines
___