pacman<- c("plotly","ggplot2")
lapply(pacman, library, character.only = TRUE)
## Loading required package: ggplot2
## 
## 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
## [[1]]
## [1] "plotly"    "ggplot2"   "stats"     "graphics"  "grDevices" "utils"    
## [7] "datasets"  "methods"   "base"     
## 
## [[2]]
## [1] "plotly"    "ggplot2"   "stats"     "graphics"  "grDevices" "utils"    
## [7] "datasets"  "methods"   "base"
graph <- ggplot(data = mpg, mapping = aes(x = cty,y =hwy, color = class))+
  geom_point()
graph

ggplotly(graph)