Overview

The aim is to Create a web page using R Markdown that features a map created with Leaflet.

Loadding the needed library

library(plotly)
## 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

Creating The Plot

plot_ly(data = mtcars, x = mtcars$wt, y = mtcars$mpg, color = mtcars$cyl, type = "scatter")
## No scatter mode specifed:
##   Setting the mode to markers
##   Read more about this attribute -> https://plot.ly/r/reference/#scatter-mode