The dataset I’ll use in the Final Project is called “Earthquake Events Worldwide 2023”. The data collection involves web scraping on the Euro-Mediterranean Seismological Centre. Currently, the dataset has 53,539 observations (earthquakes). It contains 7 columns, which are Date and Time, Latitude, Longitude, Depth (in KM - earthquake’s focus below the Earth’s surface, measured in kilometers), magnitude (representing the energy released. It goes from -1, which are so small that they are expressed in negative numbers, to 10, which are the strongest ones), lands (type of land or region affected by the earthquake) and country. The author uses “selenium automation in the EMSC website”, which ensures the extraction of up-to-date and accurate data. With the data provided, I will try to analyze trends, patterns and distributions of earthquakes around the globe. Magnitude and depth are quantitative variables. Land and country are categorical. Latitude and longitude are considered continuous numerical data. I chose this topic because I’ve always been interested in natural phenomena and this dataset contains information that allows me to dig into this topic. Also, it helps me understand better the world zones and the likelihood that earthquakes may occur. Throughout this project, I will try to answer few questions, such as at what frequency does each magnitude occur? Where did the strongest earthquakes in the year 2023 occur? Which areas of the planet have the highest incidence of earthquakes?
Dataset source: Euro-Mediterranean Seismological Centre.
Dataset collection form: According to the EMSC website, “EMSC operates a system for rapid collection, determination, and dissemination of earthquake parameters using seismic data contributed by seismological institutes around the world together with crowdsourced data from earthquake eyewitnesses.”
Open and load the packages
library(tidyverse)
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr 1.1.2 ✔ readr 2.1.4
✔ forcats 1.0.0 ✔ stringr 1.5.0
✔ ggplot2 3.4.4 ✔ tibble 3.2.1
✔ lubridate 1.9.3 ✔ tidyr 1.3.0
✔ purrr 1.0.2
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag() masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(leaflet)library(plotly)
Attaching package: 'plotly'
The following object is masked from 'package:ggplot2':
last_plot
The following object is masked from 'package:stats':
filter
The following object is masked from 'package:graphics':
layout
Rows: 53539 Columns: 7
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (3): Date & Time, Lands, Country
dbl (4): Latitude, Longitude, Depth, Magnitude
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Remove commas from the “lands” column
I removed the commas that some observations inside the “Lands” column had because they were incorrectly placed there. Also, I may explore this column further, and I don’t want these wrong commas to be shown in my output.
First visualization - Frequency of earthquakes magnitude (Histogram)
# Visualization - Histogram of Earthquake Magnitudesggplot(earthquakes_data, aes(x = Magnitude, fill = ..count..)) +geom_histogram(binwidth =0.5, fill ="blue", color ="red", alpha =0.7) +# Set fill color to "blue"scale_fill_viridis(discrete =FALSE) +theme_minimal() +labs(title ="Distribution of Earthquake Magnitudes",x ="Magnitude",y ="Frequency",caption ="Euro-Mediterranean Seismological Centre") +theme(text =element_text(family ="Arial", color ="black"),plot.title =element_text(hjust =0.5),axis.title =element_text(face ="bold"))
Warning: The dot-dot notation (`..count..`) was deprecated in ggplot2 3.4.0.
ℹ Please use `after_stat(count)` instead.
As we can see, fortunately, most of the magnitude of the earthquakes that have occurred so far in 2023 are between 1.8 and 3.9. This means that in addition to being “weak”, they also go mostly unnoticed.
Consider only earthquakes with at least a 4.0 magnitude
The reason why I’m considering only earthquakes with at least a 4.0 magnitude, is because according to the “SMS Tsunami Warning” website, from this point, it starts to break windows and damage small objects, i.e., the quakes start to cause harm and have negative consequences for human life. Magnitude levels smaller than 4.0 are not really harmful (obviously it also depends on the depth of the earthquake, but generally this is the interpretation).
Second visualization - Countries with strongest earthquakes
# Exclude specific countries from the datasetcountries_to_exclude <-c("RIDGE", "ISLANDS", "REGION")top_countries_filtered <- strong_quakes %>%filter(!Country %in% countries_to_exclude) %>%group_by(Country) %>%summarise(total_strong_quakes =n()) %>%arrange(desc(total_strong_quakes)) %>%slice_head(n =10)# Create a ggplot bar chart for the top 10 countries after filteringbar_chart_filtered <-ggplot(top_countries_filtered, aes(x =reorder(Country, total_strong_quakes), y = total_strong_quakes, fill = Country)) +geom_bar(stat ="identity") +scale_fill_manual(values =c("#FF9999", "#66B2FF", "#99FF99", "#FFCC99", "#c2c2f0", "#ffb3e6", "#c2f0c2", "#ffb366", "#ff6666", "#c2f0f0")) +labs(title ="Top 10 Countries with Strong Earthquakes \n(Magnitude >= 4.0)",x ="Country",y ="Number of Earthquakes", caption ="Euro-Mediterranean Seismological Centre") +theme_minimal() +theme(axis.text.x =element_text(angle =75, hjust =1)) # Convert to plotly for interactivityinteractive_plot_filtered <-ggplotly(bar_chart_filtered)# Display the interactive plotinteractive_plot_filtered
Caption: Euro-Mediterranean Seismological Centre
Surprisingly, Mexico is the country with the highest number of earthquakes considered “strong.” Despite “SEA” is not a country, I left in the visualization to call the attention that at sea there is a great occurrence of strong earthquakes. “P.N.G” also known as Papua New Guinea. I also excluded some “generic” terms that are in the were in my visualization, such as “region”, “ridge” and “islands”, because they’re not countries.
Third visualization - Geographically plotting the earthquakes
For those who don’t have a good sense of geography like me, I had to plot the map so that you would have an idea of where earthquakes actually occur the most. It draws attention that in Russia for example, which is the largest country in the world, there is very little incidence of earthquakes, whereas in Japan and Indonesia (“small” countries) for example, the territory is practically entirely covered by points, that is, there are a high incidence of earthquakes in these 2 countries. Each dot represents an earthquake.
Essay
I started researching and discovered that one of the reasons why Indonesia suffers from large amounts of earthquakes is because it is located at the meeting of 5 tectonic plates that are active. Earthquakes occur daily (usually magnitude 5). The country was devastated by the earthquake (followed by a tsunami) in 2004. It recorded the highest magnitude ever, 9.3, and the longest duration ever seen (approximately 10 minutes). Japan, in turn, suffered a terrible tsunami in 2011 (magnitude scale 9.0). The epicenter of the earthquake occurred 80km northeast of the city of Tohoku. The waves formed by the tsunami reached 40 meters and advanced 10km towards the continent. More than 18 thousand people died and thousands more were injured. Japan is located in an area known as the “Pacific Ring of Fire, where it lies across three tectonic plates, including the Pacific Plate under the Pacific Ocean and the Philippine Sea Plate.”Another subject that aroused my curiosity was the San Andreas fault, whose origin was in 1906 in an earthquake that killed more than 3000 people. There is concern that the rupture will increase and cause more harm to the population of California, but no scientist can pinpoint when or how this failure will worsen.
I would like to have colored the plots of my 3rd visualization according to the intensity of the earthquakes. I also wish I had been able to include the caption within the 2nd and 3rd visualizations.
Bibliography
Pribadi, K. Suryanto, and D. K. Rildova. “Learning from recent Indonesian earthquakes: An overview to improve structural performance.” 14th world conference on earthquake engineering, Beijing, China. 2008.
Ando, Shuntaro, et al. “Mental health problems in a community after the Great East Japan Earthquake in 2011: a systematic review.” Harvard review of psychiatry 25.1 (2017): 15-28
Hale, Tom. “Why We Need to Pay Attention to the San Andreas Fault.” IFLScience, 13 Oct. 2023, www.iflscience.com/why-we-need-to-pay-attention-to-the-san-andreas-fault-71115.