MulaiMulai sekarang secara gratis

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.

Latihan ini adalah bagian dari kursus

Intermediate Interactive Data Visualization with plotly in R

Lihat Kursus

Petunjuk latihan

  • 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.

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# 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
  ___
Edit dan Jalankan Kode