In this post, we’ll create a visually engaging map to explore the global distribution of criminality. By using a dataset containing information on various countries’ crime rates, we can gain valuable insights into regional patterns and potential underlying factors.
First, we’ll load the necessary libraries and read the data
from https://ocindex.net/downloads:
library(rio)
library(ggplot2)
library(dplyr)
library(rworldmap)
library(rnaturalearth)
library(rnaturalearthdata)
df=import('https://ocindex.net/assets/downloads/global_oc_index.xlsx', sheet=2)
A quick peep inside the data:
glimpse(df)
## Rows: 193
## Columns: 39
## $ Continent <chr> "Asia", "Africa", "Asia",…
## $ Region <chr> "Southern Asia", "North A…
## $ Country <chr> "Afghanistan", "Libya", "…
## $ `Criminality avg,` <dbl> 7.10, 6.93, 8.15, 6.57, 6…
## $ `Criminal markets avg,` <dbl> 7.00, 6.57, 7.70, 5.63, 5…
## $ `Human trafficking` <dbl> 9.0, 8.5, 8.5, 9.0, 7.5, …
## $ `Human smuggling` <dbl> 9.5, 9.5, 8.0, 9.0, 5.5, …
## $ `Arms trafficking` <dbl> 9.0, 9.0, 9.0, 9.5, 9.0, …
## $ `Flora crimes` <dbl> 5.5, 1.0, 8.5, 2.5, 7.0, …
## $ `Fauna crimes` <dbl> 3.5, 3.5, 8.5, 4.0, 8.0, …
## $ `Non-renewable resource crimes` <dbl> 6.5, 9.5, 9.0, 7.5, 10.0,…
## $ `Heroin trade` <dbl> 9.5, 2.5, 9.5, 2.5, 1.5, …
## $ `Cocaine trade` <dbl> 1.0, 5.5, 3.5, 2.0, 1.5, …
## $ `Cannabis trade` <dbl> 7.5, 7.0, 4.5, 4.0, 3.5, …
## $ `Synthetic drug trade` <dbl> 9.0, 7.5, 10.0, 4.5, 7.0,…
## $ `Cyber-dependent crimes` <dbl> 4.0, 3.5, 7.5, 1.5, 2.0, …
## $ `Financial crimes` <dbl> 7.5, 9.5, 8.5, 8.0, 3.5, …
## $ `Trade in counterfeit goods` <dbl> 8.5, 6.0, 6.0, 6.5, 7.0, …
## $ `Illicit trade in excisable goods` <dbl> 9.0, 7.0, 7.0, 6.0, 4.5, …
## $ `Extortion and protection racketeering` <dbl> 6.0, 9.0, 7.5, 8.0, 6.5, …
## $ `Criminal actors avg,` <dbl> 7.2, 7.3, 8.6, 7.5, 7.9, …
## $ `Mafia-style groups` <dbl> 5.0, 9.0, 9.5, 7.0, 8.0, …
## $ `Criminal networks` <dbl> 8.0, 7.5, 8.0, 8.0, 8.0, …
## $ `State-embedded actors` <dbl> 9.0, 9.5, 9.0, 8.0, 9.0, …
## $ `Foreign actors` <dbl> 6.0, 5.5, 9.0, 8.5, 9.0, …
## $ `Private sector actors` <dbl> 8.0, 5.0, 7.5, 6.0, 5.5, …
## $ `Resilience avg,` <dbl> 1.50, 1.54, 1.63, 1.75, 1…
## $ `Political leadership and governance` <dbl> 1.5, 1.5, 1.5, 1.5, 1.5, …
## $ `Government transparency and accountability` <dbl> 1.0, 1.5, 1.5, 1.5, 1.5, …
## $ `International cooperation` <dbl> 1.0, 2.5, 2.0, 3.0, 3.0, …
## $ `National policies and laws` <dbl> 1.5, 2.0, 2.0, 2.0, 2.0, …
## $ `Judicial system and detention` <dbl> 1.5, 1.5, 1.5, 1.5, 2.0, …
## $ `Law enforcement` <dbl> 1.5, 1.5, 1.5, 2.0, 1.5, …
## $ `Territorial integrity` <dbl> 3.5, 1.5, 2.0, 1.5, 1.5, …
## $ `Anti-money laundering` <dbl> 1.0, 1.0, 2.0, 2.0, 2.0, …
## $ `Economic regulatory capacity` <dbl> 1.5, 2.0, 1.5, 2.0, 1.5, …
## $ `Victim and witness support` <dbl> 1.5, 1.0, 1.0, 1.0, 2.5, …
## $ Prevention <dbl> 1.5, 1.0, 1.5, 1.0, 1.0, …
## $ `Non-state actors` <dbl> 1.0, 1.5, 1.5, 2.0, 1.5, …
The names contain spaces, so let’s fix that first using
clean_names from janitor package:
df=df %>% janitor::clean_names()
Next, we’ll join the data with the world map and create the
visualization:
world <- ne_countries(scale = "medium", returnclass = "sf")
world_map <- world %>%
left_join(df, by = c("name" = "country"))
ggplot(world_map) +
geom_sf(aes(fill = cannabis_trade), color = NA) +
scale_fill_viridis_c(option = "plasma", na.value = "#fffff0", name = 'cannabis_trade') +
theme_minimal() +
theme(panel.grid = element_blank(),
panel.border = element_blank(),
legend.position = "bottom",
legend.direction = "horizontal",
legend.key.width = unit(2, "cm")) +
labs( subtitle = "Global Cannabis trade",
caption = "Source: The Global Organized Crime Index report")
Bishwajit Ghose