We shall “install.packages(”plotly“)”!

library(plotly)
## Warning: package 'plotly' was built under R version 3.6.3
## 
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## The following object is masked from 'package:stats':
## 
##     filter
## The following object is masked from 'package:graphics':
## 
##     layout
date()
## [1] "Mon Oct 12 13:56:32 2020"

Are you looking for a vacation home in the state of Texas?

Vacation1 <- plot_ly(highlight_key(txhousing, ~city, "select a city"))

D_1 <- ggplot(Vacation1, aes(date, median, group= city)) + geom_line()

Vac2 <- ggplotly(D_1, tooltip = "city") %>%
    layout(title = "Click on an area for your vaction home location in Texas") %>%
    highlight(dynamic = TRUE, selectize = TRUE)
## Warning: `group_by_()` is deprecated as of dplyr 0.7.0.
## Please use `group_by()` instead.
## See vignette('programming') for more help
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_warnings()` to see where this warning was generated.
## Adding more colors to the selection color palette.
Vac2
## Setting the `off` event (i.e., 'plotly_doubleclick') to match the `on` event (i.e., 'plotly_click'). You can change this default via the `highlight()` function.