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!
library(leaflet)
library(dplyr)
##
## 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
Significant Earthquakes, 1965-2016: This dataset includes a record of the date, time, location, depth, magnitude, and source of every earthquake with a reported magnitude 5.5 or higher since 1965 (https://www.kaggle.com/usgs/earthquake-database)
earthquakes <- read.csv("D:/Coursera/Developing Data Products/Proyecto1/database.csv", header=T)
Because the database is very large and there may be problems when graphing the map we will filter by the date field, to select only those events presented in the month of December 2016
earthquakes$Date <- as.Date(earthquakes$Date, format= "%m/%d/%Y")
earthquakes.2016.dec <- subset(earthquakes, Date> "2016-12-01" & Date < "2016-12-31")
We will use a color scale in order to represent those events with a higher magnitude in red and those with a lower magnitude in green
pal <- colorFactor(
palette = c('green','red'),
domain = earthquakes.2016.dec$Magnitude)
Finally we will graph the map with the events that occurred in December 2016
my_map <- leaflet(earthquakes.2016.dec) %>% addTiles() %>%
addCircles(lng = ~Longitude, lat = ~Latitude, weight = 1,
radius = ~(Magnitude)*100000,
color = ~pal(Magnitude))
my_map