Aan de slagGa gratis aan de slag

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.

Deze oefening maakt deel uit van de cursus

Intermediate Interactive Data Visualization with plotly in R

Cursus bekijken

Oefeninstructies

  • 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 against year by state.

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# 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
  ___
Code bewerken en uitvoeren