## 
## Attaching package: 'lubridate'
## The following object is masked from 'package:base':
## 
##     date
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:lubridate':
## 
##     intersect, setdiff, union
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union

Introduction

This data reflects the known impact locations of meteorites worlwide. Examinging this data, it’s advantageous to know the differences between meteroids, meteors, and meteorites. Meteoroids are rocky remnants of a comet or asteroid that travel in outer space, and when these objects enter Earth’s atmosphere they are considered meteors. Most meteors burn and disintegrate in the Earth’s atmosphere resulting in bright streaks that can host quite a spectacle for night-sky observers. The small percentage of meteors that survive the atmosphere and high-speed impact are called meteorites, and are the sole focus of our data.

Data

The original dataset was provided by The Meteoritical Society and downloaded from NASA’s Data Portal. The dataset was available for download through kaggle.com.

meteorite <- read.csv("C:/Users/Roberto/Documents/meteorite_data.csv")
head(meteorite)
##       name  id nametype    recclass   mass fall year    reclat    reclong
## 1   Aachen   1    Valid          L5     21 Fell 1880  50.77500    6.08333
## 2   Aarhus   2    Valid          H6    720 Fell 1951  56.18333   10.23333
## 3     Abee   6    Valid         EH4 107000 Fell 1952  54.21667 -113.00000
## 4 Acapulco  10    Valid Acapulcoite   1914 Fell 1976  16.88333  -99.90000
## 5  Achiras 370    Valid          L6    780 Fell 1902 -33.16667  -64.95000
## 6 Adhi Kot 379    Valid         EH4   4239 Fell 1919  32.10000   71.80000
##                GeoLocation
## 1    (50.775000, 6.083330)
## 2   (56.183330, 10.233330)
## 3 (54.216670, -113.000000)
## 4  (16.883330, -99.900000)
## 5 (-33.166670, -64.950000)
## 6   (32.100000, 71.800000)

Let’s examine the structure of our dataset:

str(meteorite)
## 'data.frame':    45716 obs. of  10 variables:
##  $ name       : Factor w/ 45716 levels "Österplana 002",..: 68 69 73 77 473 484 496 497 502 521 ...
##  $ id         : int  1 2 6 10 370 379 390 392 398 417 ...
##  $ nametype   : Factor w/ 2 levels "Relict","Valid": 2 2 2 2 2 2 2 2 2 2 ...
##  $ recclass   : Factor w/ 466 levels "Acapulcoite",..: 333 197 85 1 339 85 360 190 339 242 ...
##  $ mass       : num  21 720 107000 1914 780 ...
##  $ fall       : Factor w/ 2 levels "Fell","Found": 1 1 1 1 1 1 1 1 1 1 ...
##  $ year       : int  1880 1951 1952 1976 1902 1919 1949 1814 1930 1920 ...
##  $ reclat     : num  50.8 56.2 54.2 16.9 -33.2 ...
##  $ reclong    : num  6.08 10.23 -113 -99.9 -64.95 ...
##  $ GeoLocation: Factor w/ 17101 levels "","(-1.002780, 37.150280)",..: 16779 16983 16923 9106 844 14808 16496 16453 784 721 ...

Provided in the original dataset are 10 variables that include the name of the meteorite, its mass, the year it was discovered, etc. For this map, what is most importatnt is the reclat and reclong variables which are “recommended latitude”, and “recommended longitude”, respectively.

There were a few issues with the data set that were addressed. It was explained on the source’s website that some meteorites had lat/long input of 0N/0E that should be treated as NA. The years of discover should only be between 860 and 2016, so therefore we will remove obs with years outside of that range.

meteorite2 <- filter(meteorite, year >= 860 & year <= 2016 & reclong<=180 & reclong>=-180 & (reclat!=0 | reclong!=0))

This filtering reduced our observations from roughly 45K to 32K, but it was a necessary step. Secondly, I want to use only complete cases.

sum(!complete.cases(meteorite2))
## [1] 107

There is only 107 incomplete cases so those will be removed from the dataset.

meteorite3 <- filter(meteorite2, complete.cases(meteorite2))

The map will feature the location and full information of 31,929 meteorites across the globe.

Mapping

Creating icon:

alien <- makeIcon("F:/alien_icon.png", iconWidth = 31*215/230, iconHeight = 31)

Grouping Data:

met4 <- mutate(meteorite3, roundmass = ceiling(meteorite3$mass))

met5 <- mutate(met4, size = ifelse(roundmass %in% 0:10, "(0g - 10g]", ifelse(roundmass %in% 11:100, "(10g - 100g]", ifelse(roundmass %in% 101:1000, "(100g - 1kg]", ifelse(roundmass %in% 1001:10000, "(1kg - 10kg]", ifelse(roundmass %in% 10001:100000, "(10kg - 100kg]", ifelse(roundmass %in% 100001:1000000, "(100kg - 1,000kg]", ifelse(roundmass %in% 1000001:10000000, "(1,000kg - 10,000kg]", ifelse(10000001:100000000, "(10,000kg - 100,000kg]", "unknown")))))))))

met_data <- subset(met5, select = -roundmass)

met_data.df <- split(met_data, met_data$size)

Creating Map:

In the map below, you can click the alien head icons to view information on the meteorite discoved in that area. You will be able to view the name of the meteorite (typically named after the location), the year it was discovered, its mass in grams, and the meteorite’s classification.

meteorite_map <- met_data %>% leaflet() %>% addProviderTiles("Esri.WorldImagery", group="background 1") %>%
addTiles(options = providerTileOptions(noWrap = TRUE), group="background 2") %>% addMarkers(lng = met_data$reclong, lat = met_data$reclat, icon = alien, clusterOptions = markerClusterOptions(), popup = paste("Name:", met_data$name, "<br>", "Year Discovered:", met_data$year, "<br>", "Mass in Grams:", met_data$mass, "<br>", "Classification:", met_data$recclass), group = names(met_data.df)) %>% addLayersControl(baseGroups = c("background 1","background 2"), options = layersControlOptions(collapsed=TRUE))

meteorite_map

Conclusion

You might notice that there is plenty of extra code that may seem excessive when examining the output. The reason for this was I attempted for hours on end to create a categorical variable (met_date$size) that I could use so that each category acted as a layer to the map. Unfortunately, after hours and days of failed attempts, the categorical variable I created was left unused. However, the map is still incredibly interesting and very useful in expounding upon one’s knowledge of meteorites.