Creating a web page using R Markdown and Leaflet.

Overview

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. We would love to see you show off your creativity

Operations

This data was create randomly with only academic purpose, so this data does not say anything about the reality Crime Rate in USA.

library(leaflet)
## Warning: package 'leaflet' was built under R version 4.0.2
library(readxl)
data <- read_excel("data_usa.xlsx",col_names = TRUE)
head(data)
## # A tibble: 6 x 5
##    Rank Ciudad        Lati  Long Crime_Rate
##   <dbl> <chr>        <dbl> <dbl>      <dbl>
## 1     1 Indianapolis  39.8 -86.2      1334 
## 2     2 Chicago       41.9 -87.7      1099.
## 3     3 Houston       29.8 -95.4      1095.
## 4     4 Philadelphia  40.0 -75.2       948.
## 5     5 Columbus      40.0 -83.0       882 
## 6     6 Jacksonville  30.3 -81.7       847

Now we need to create the map.

maping <- data%>%
  leaflet() %>%
  addTiles() %>%  setView(lng = -85, lat = 40, zoom = 3) %>%
  addMarkers(popup = data$Ciudad,lat = data$Lati, lng = data$Long ) %>%
  addCircles(weight = 50,radius = data$Crime_Rate, lat = data$Lati, lng = data$Long)

maping