Many time series
How did the housing price index change from 2000 to 2017 in the United States? To begin answering this question, your task is to create a line chart representing the housing price index for each state over this time period.
Once you have created this plot, be sure to consider how easy or hard it is to interact with. Specifically, how easy is it to select a single state's trajectory?
plotly
, dplyr
, and the us_economy
data set have already been loaded.
This exercise is part of the course
Intermediate Interactive Data Visualization with plotly in R
Exercise instructions
- Filter out the data from
2000
onward. - Next, group the data by
state
. - Finally, create a time series plot displaying how the housing price index (
house_price
) has changed over time (year
).
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Create a line chart of house_price over time by state
us_economy %>%
___(___ >= ___) %>%
___(___) %>%
___(x = ___, y = ___) %>%
___()