Instructions

Create a web page using R Markdown that features a map created with Leaflet. Host your webpage on either GitHub Pages, RPubs, or NeoCities. Your webpage must contain the date that you created the document, and it must contain a map created with Leaflet.

Review criteria

The rubric contains the following two questions:

  1. Does the web page feature a date and is this date less than two months before the date that you’re grading this assignment?

  2. Does the web page feature an interactive map that appears to have been created with Leaflet?

Leaflet map

Click on the markers to get the location name

Load required libraries

library(leaflet)
## Warning: package 'leaflet' was built under R version 4.2.2
library(dplyr)
## Warning: package 'dplyr' was built under R version 4.2.2
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union

Assign the data

locations <- data.frame(lat = c(26.4, 30.1666, 24.6833, 21.3666),
                        lng = c(90.633, 74.1666, 72.8333, 77.5333))

locNames <- c('Karaikal', 'Karaikkudi', 'Karamnasa', 'Karanjia')

Create the leaflet map

locations %>%
        leaflet() %>%
        addTiles() %>%
        addMarkers(popup = locNames)