The map is of all meteorite landings from 1986 through 2016 recorded by the The Meteoritical Society. The original dataset contained values well before 1986, but for the purpose of displaying frequency of meteorite landings the data was removed since the events before 1986 were not recorded regularly. The dataset was also filtered for irregularities, removing values that did not have accurate latitude and longitudinal coordinates.
library(leaflet)
library(dplyr)
library(Hmisc)
options("scipen"=100, "digits"=4)
meteorites <- read.csv("meteorite-landings.csv")
meteorites_sub <- meteorites[,c(1,5,7,8,9)]
keep <- complete.cases(meteorites_sub)
meteorites_sub <- meteorites_sub[keep,]
meteorites_sub <- subset(meteorites_sub, year >= 1986 & year <=2016)
meteorites_sub <- subset(meteorites_sub, reclong <= 180 & reclong >= -180 & (reclat != 0 | reclong != 0))
meteorites_sub <- meteorites_sub[order(meteorites_sub$mass, decreasing = TRUE),]
map_meteorites <- meteorites_sub
names(map_meteorites) <- c("name","mass","year","lat","lng")
meteorites_map_cut <- mutate(map_meteorites,size = cut2(mass, cuts = c(100,10000)))
meteorites_map_cut$size <- factor(meteorites_map_cut$size, labels = c("Small","Medium","Large"))
small_meteorites <- meteorites_map_cut[meteorites_map_cut$size == "Small",]
medium_meteorites <- meteorites_map_cut[meteorites_map_cut$size == "Medium",]
large_meteorites <- meteorites_map_cut[meteorites_map_cut$size == "Large",]
leaflet() %>%
addTiles(options = providerTileOptions(minZoom = 2, maxZoom = 12)) %>%
setView(lat=38.350033, lng=-98.6500523, 4) %>%
addCircles(weight = 1,
lat = small_meteorites$lat,
lng = small_meteorites$lng,
group='Small Meteorites',
radius = sqrt(small_meteorites$mass)*400,
popup = paste("Meteorite Name:",small_meteorites$name,"<br>",
"Year Landed:",small_meteorites$year,"<br>",
"Mass (grams):",small_meteorites$mass)) %>%
addCircles(weight = 1,
lat = medium_meteorites$lat,
lng = medium_meteorites$lng,
group='Medium Meteorites',
radius = sqrt(medium_meteorites$mass)*400,
popup = paste("Meteorite Name:",medium_meteorites$name,"<br>",
"Year Landed:",medium_meteorites$year,"<br>",
"Mass (grams):",medium_meteorites$mass)) %>%
addCircles(weight = 1,
lat = large_meteorites$lat,
lng = large_meteorites$lng,
group='Large Meteorites',
radius = sqrt(large_meteorites$mass)*400,
popup = paste("Meteorite Name:",large_meteorites$name,"<br>",
"Year Landed:",large_meteorites$year,"<br>",
"Mass (grams):",large_meteorites$mass)) %>%
addLayersControl(
overlayGroups =c('Small Meteorites',
'Medium Meteorites',
'Large Meteorites'),
options = layersControlOptions(collapsed=FALSE))