The dataset originates from the esteemed Pew Research Center and their data is featured in their comprehensive analysis of religious restrictions specifically in the Asian-Pacific, Middle East, and African regions. I had to take their data and compile it into an excel. It includes key variables including country, year, location, Government Restriction Index (GRI), and Social Hostilities Index (SHI).
The Government Restriction Index (GRI) was created through an examination of governmental regulations, policies, and laws that impose limitations on religious beliefs and practices. This includes assessing whether governments provide preferential treatment to specific religious groups, or enact bureaucratic hurdles hindering certain groups from accessing benefits. Based on these factors each country was given a score; the lower the better.
Conversely, the Social Hostilities Index (SHI) was crafted by tracking various events such as incidents of religion-related harassment, mob violence, terrorism or militant activities, and conflicts arising from religious conversions or the display of religious symbols and attire. I am curious to find out the relationship between GRI and SHI along with which countries in these regions have the lowest and highest values for each.
The data set presents an invaluable opportunity to delve into historical trends and discern the intricate relationship between GRI and SHI, enabling insightful cross-continental comparisons to uncover nuances in how religious restrictions impact social hostilities across different regions.
#Load librariesinstall.packages("highcharter")
Installing package into '/cloud/lib/x86_64-pc-linux-gnu-library/4.4'
(as 'lib' is unspecified)
install.packages("leaflet")
Installing package into '/cloud/lib/x86_64-pc-linux-gnu-library/4.4'
(as 'lib' is unspecified)
── 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
Registered S3 method overwritten by 'quantmod':
method from
as.zoo.data.frame zoo
Highcharts (www.highcharts.com) is a Highsoft software product which is
not free for commercial and Governmental use
Rows: 339 Columns: 7
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (4): Country, Location, GRI, SRI
dbl (3): Year, Lat, Lon
ℹ 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.
#filter for 2016DF_filtered <- DF |>filter(Year ==2016)
#convert to numeric typeDF_filtered$GRI <-as.numeric(DF_filtered$GRI)DF_filtered$SRI <-as.numeric(DF_filtered$SRI)
#Create scatterplotDF_filtered_chart <-ggplot(DF_filtered, aes(x = GRI, y = SRI)) +xlab("Government Restriction Index ") +ylab("Social Hostilities Index") +ggtitle("GRI VS SRI In 2016") +theme_minimal(base_size =14, base_family ="serif") +scale_x_continuous(breaks =1:10) +# Specify the breaks for the x-axisscale_y_continuous(breaks =1:10) # Specify the breaks for the y-axis
#convert to numericDF_filtered2$GRI <-as.numeric(DF_filtered2$GRI)
Warning: NAs introduced by coercion
DF_filtered2$SRI <-as.numeric(DF_filtered2$SRI)
Warning: NAs introduced by coercion
#facet scatterplotDF_filtered_chart2 <-ggplot(DF_filtered2, aes(x = GRI, y = SRI, col = Location)) +geom_point(alpha =0.8) +guides(size ="none") +theme(plot.title =element_blank(), legend.title =element_blank()) +xlab("Government Restriction Index") +ylab("Social Hostilities Index") +geom_text(aes(x =6, y =9, label = Year), cex =12, color ="grey") +facet_grid(. ~ Year) +theme(strip.background =element_blank(),strip.text.x =element_blank(),strip.text.y =element_blank(),legend.position ="top") +scale_x_continuous(breaks =0:10, limits =c(0, 10)) +# Specify the breaks and limits for the x-axisscale_y_continuous(breaks =0:10, limits =c(0, 10)) # Specify the breaks and limits for the y-axis
#printprint(DF_filtered_chart2)
Warning: Removed 1 row containing missing values or values outside the scale range
(`geom_point()`).
#create scatterplothc <-highchart()unique_locations <-na.omit(unique(DF_filtered$Location)) # Remove NA values from unique locations# Define colors for each locationlocation_colors <-c("#00FF2E", "#057DFF", "yellow") # Add series for each location, excluding Series 4for (i inseq_along(unique_locations)) { loc <- unique_locations[i]# Skip if loc is NAif (is.na(loc)) {next# Skip to the next iteration } data <- DF_filtered[DF_filtered$Location == loc, ] hc <- hc |>hc_add_series(data = data,type ="scatter",hcaes(x = GRI, y = SRI, text =paste("Location:", Location, "<br>Country:", Country, "<br>SRI:", SRI, "<br>GRI:", GRI)),name = loc,color = location_colors[i], # Assign color based on locationmarker =list(symbol ="circle", radius =4) )}hc <- hc |>hc_tooltip(pointFormat ="<b>{point.text}</b>") |>hc_xAxis(title =list(text ="Government Restriction Index")) |># Add x-axis labelhc_yAxis(title =list(text ="Social Hostilities Index")) |># Add y-axis labelhc_title(text ="Scatter Plot of GRI vs. SHI In 2016") |># Add chart titlehc_add_theme(hc_theme_darkunica()) |># Add Dark Unica themehc_chart(events =list(load =JS("function() { this.renderer.text('Source: Pew Research Center', this.plotLeft + 10, this.plotTop + this.plotHeight + 40) .attr({ zIndex: 6, fill: 'white' }).add(); }")))hc
Explore the intersection of societal responsibility and well-being with this scatterplot showcasing the Global Responsibility Index (GRI) and Social Health Index (SHI) for countries across the Asia-Pacific, Middle East-North Africa, and Sub-Saharan Africa regions in 2016. Each point represents a nation, offering insight into its unique position on the global stage. Hover over any point to reveal the country name along with its corresponding SHI and GRI values, providing a snapshot of its societal dynamics. This visualization offers a glimpse into the complex interplay of factors shaping our world, inviting exploration and fostering understanding of global trends and disparities.
#filter for high GRI valuesTop10df <- DF_filtered |>filter(GRI >=6.7& GRI <=10) |>top_n(10, GRI)
#clarify its a data frameTop10df <-as.data.frame(Top10df)
#plothc <-highchart() |>hc_xAxis(categories =unique(Top10df_reshaped$Country),title =list(text ="Country")) |>hc_add_series(name ="GRI", data = Top10df_reshaped |>filter(Index_Type =="GRI") |>pull(Value)) |>hc_add_series(name ="SRI", data = Top10df_reshaped |>filter(Index_Type =="SRI") |>pull(Value)) |>hc_title(text ="Top 10 Countries with the Highest Government Restriction Index (GRI) in 2016") |>hc_yAxis(title =list(text ="Value"))hc
#plothc <- hc |>hc_chart(borderColor ='#EBBA95',borderRadius =10,borderWidth =2,backgroundColor =list(linearGradient =c(0, 0, 500, 500),stops =list(list(0, 'rgb(255, 255, 255)'),list(1, 'rgb(200, 200, 255)') ))) |>hc_xAxis(title =list(text ="Country")) |>hc_yAxis(title =list(text ="Value")) |>hc_title(text ="Top 10 Countries with the Highest Government Restriction Index (GRI) in 2016")hc
# Reshape the data to have separate columns for each country's GRI and SRI valuesTop10df_reshaped <- Top10df |>select(Country, GRI, SRI,Location) |>pivot_longer(cols =c(GRI, SRI), names_to ="Index_Type", values_to ="Value")# Create Highcharter plot with 3D columnshc <-highchart() |>hc_chart(type ="column",options3d =list(enabled =TRUE, beta =15, alpha =15)) |>hc_xAxis(categories =unique(Top10df_reshaped$Country),title =list(text ="Country", margin =20)) |># Adjust margin for the x-axis titlehc_add_series(name ="GRI", data = Top10df_reshaped |>filter(Index_Type =="GRI") |>pull(Value)) |>hc_add_series(name ="SRI", data = Top10df_reshaped |>filter(Index_Type =="SRI") |>pull(Value)) |>hc_title(text ="GRI and SRI for Top 10 Countries") |>hc_yAxis(title =list(text ="Value"))hc
color_ranges <-list(list(from =0, to =1.4, color ="#90EE90"), # Light green for values less than or equal to 1.4list(from =1.5, to =3.5, color ="#FFFF00"), # Yellow for values between 1.5 and 3.5list(from =3.6, to =7.1, color ="#FFA500"), # Orange for values between 3.6 and 7.1list(from =7.2, to =10, color ="#8B0000") # Dark red for values 7.2 or higher)
gri_color <-"#A9A9A9"# Light grey color for GRI seriessri_color <-"#454545"# Blue color for SRI series
#plothc <-highchart() |>hc_chart(type ="column") |>hc_xAxis(categories =unique(Top10df_reshaped$Country),title =list(text ="Country", margin =20)) |>hc_add_series(name ="GRI", data = Top10df_reshaped |>filter(Index_Type =="GRI") |>pull(Value),color = gri_color) |># Set color for GRI serieshc_add_series(name ="SHI", data = Top10df_reshaped |>filter(Index_Type =="SRI") |>pull(Value),color = sri_color) |># Set color for SRI serieshc_title(text ="Top 10 Countries with the Highest Government Restriction Index (GRI) in 2016") |>hc_yAxis(title =list(text ="Value"), # Configure y-axis titleplotBands = color_ranges) hc <- hc |>hc_chart(events =list(load =JS("function() { this.renderer.text('Source: Pew Research Center', this.plotLeft + 10, this.plotTop + this.plotHeight + 100) .attr({ zIndex: 6, fill: 'black' }).add(); }")))hc
#plothc <-highchart() |>hc_chart(type ="column",options3d =list(enabled =TRUE, beta =15, alpha =15)) |>hc_xAxis(categories =unique(Top10df_reshaped$Country),title =list(text ="Country", margin =20)) |>hc_add_series(name ="GRI", data = Top10df_reshaped |>filter(Index_Type =="GRI") |>pull(Value),color = gri_color) |># Set color for GRI serieshc_add_series(name ="SHI", data = Top10df_reshaped |>filter(Index_Type =="SRI") |>pull(Value),color = sri_color) |># Set color for SRI serieshc_title(text ="Top 10 Countries with the Highest Government Restriction Index (GRI) in 2016") |>hc_yAxis(title =list(text ="Value"), # Configure y-axis titleplotBands = color_ranges) hc <- hc |>hc_chart(events =list(load =JS("function() { this.renderer.text('Source: Pew Research Center', this.plotLeft + 10, this.plotTop + this.plotHeight + 40) .attr({ zIndex: 6, fill: 'black' }).add(); }")))hc
This bar graph shows the values of GRI and SHI in the top 10 countries with the highest Government Restriction Index. It also shows the bar graph for SHI. The background colors represent how Pew Research Center defines low, mild, high, and very high restrictions in regards to SHI. This way we can visually compare the heights of the SHI bars to see how they rank according to Pew Research Center.
While exploring the Pew Research Center website they discussed how in 2016, religious issues pervaded the countries of China, Indonesia, Iran, Malaysia, Maldives, Turkmenistan, Uzbekistan, Algeria, Egypt, and Syria, each grappling with distinct challenges and tensions. China’s government imposed stringent regulations on religious practices, targeting unregistered groups and minorities like Christians, Muslims (particularly Uighurs), and Tibetan Buddhists. Indonesia faced interreligious tensions, primarily between Muslims and Christians, occasionally erupting into violence. Iran’s strict controls on religious expression continued, particularly affecting Baha’is, Christians, and Sunni Muslims. Malaysia and the Maldives struggled with restrictions on religious freedom and discrimination against religious minorities, while Turkmenistan and Uzbekistan enforced tight control over religious activities, facing criticism for persecution of Jehovah’s Witnesses and Christians. Algeria saw tensions between its Muslim majority and religious minorities, while Egypt grappled with sectarian violence against Coptic Christians and restrictions on church construction. Syria’s complex civil war exacerbated religious dynamics, leading to persecution, displacement, and destruction of religious sites among various communities. These issues underscored the diverse religious landscapes and challenges encountered across the region, from state-imposed restrictions to interfaith tensions and conflict-related strife.
#filter highest SHI valuestop_10_highest_sri_countries <- DF_filtered |>arrange(desc(SRI)) |># Arrange the dataframe by SRI in descending orderhead(10) # Get the top 100 rows <- DF_filtered %>%
#Leafletleaflet(top_10_highest_sri_countries) |>addTiles() |># Add default OpenStreetMap tilesaddCircleMarkers(~Lon, ~Lat, radius =8, # Increased radius for larger pointscolor =~palette(SRI),fillOpacity =0.7,popup =~paste("SRI: ", SRI)) |>addLegend("bottomright", pal = palette, values =~SRI, title ="Value", opacity =1) |>addControl(position ="topleft",html ="<h3>Top 10 Countries With The Highest SHI values in 2016</h3>" ) |>addControl(position ="bottomleft",html ="<p>Pew Research Center</p>" )
The final chart presents a map highlighting the top 10 countries with the highest Social Health Index (SHI) in 2016 within the specified regions: Asia-Pacific, Middle East-North Africa, and Sub-Saharan Africa. The map uses a color gradient to show how these countries rank among themselves, with red indicating lower rankings and dark blue representing the highest rankings. This visual representation offers insight into the health and well-being dynamics across these regions. It allows us to observe the variations in health outcomes and highlights the disparities and successes among nations. By focusing on the SHI rankings, the map encourages discussions about equity and the need for collective efforts to improve health outcomes globally.