The Gross domestic Product (GDP) per capita was downloaded from the World Bank.
Link:
https://data.worldbank.org/indicator/NY.GDP.PCAP.CD?locations=DO&most_recent_value_desc=false
First setting up working directory and downloading the necessary files
setwd("D:/Medium/Hispaniola_Fourth_article/API_NY.GDP.PCAP.CD_DS2_en_csv_v2_2627294/API_NY.GDP.PCAP.CD_DS2_en_csv_v2_2627294")
library(readr)
library (tidyverse)
library(ggbreak)
library(plotly)
data <- read_csv("API_NY.GDP.PCAP.CD_DS2_en_csv_v2_2627294.csv",
skip = 3)
The data set contains GDP per capita for the entire world. We need to filter out Haiti and Dominican Republic dataset.
Hispaniola <- data %>%
filter (`Country Name` == "Haiti" | `Country Name` == "Dominican Republic")
The data is in wide format. We need to make the data into long format.
Hispaniola_long <- Hispaniola %>%
select (-`Country Code`, -`Indicator Name`, -`Indicator Code`) %>%
pivot_longer(!`Country Name`, names_to = "Year",
values_to = "GDP Per Capita")
Two rows (one for Haiti and one for Dominican Republic) has “X66” for their records. It looks like the data is missing for 2021 because 2021 has not ended yet. Let us remove those rowss
Hispaniola_long <- Hispaniola_long %>%
filter (Year != "X66")
Remember that Year is in ‘character’ format. We need to change into either ‘numberic’ or ‘date’ format
Hispaniola_long$Year <- as.numeric(Hispaniola_long$Year)
plot <- ggplot (data = Hispaniola_long, aes (x = Year, y = `GDP Per Capita`,
group = `Country Name`,
color = `Country Name`)) +
geom_line( size = 1.5)+
theme_bw()
plot1 <- plot
scale_x_continuous(labels = seq(1980, 2020,10 ))
## <ScaleContinuousPosition>
## Range:
## Limits: 0 -- 1
ggplotly(plot1)
This data set was downloaded from ESRI Living Atlas Global Land Cover 2050. The raster data was processed in ArcGIS Pro 2.8. The attributed table was exported as csv files.
library(readr)
DominicanRepublic_2050 <- read_csv("DominicanRepublic_2050.csv")
library(readr)
Haiti2050 <- read_csv("Haiti2050.csv")
Hispaniola <- rbind(DominicanRepublic_2050, Haiti2050)
plot2 <- ggplot (data = Hispaniola, aes (x = Percent, y = ClassName, fill = Country))+
geom_col(position = "dodge")+
theme_bw()
ggplotly(plot2)
haiti2020 <- read_csv("haiti2020.csv")
##
## -- Column specification --------------------------------------------------------
## cols(
## Country = col_character(),
## OID_ = col_double(),
## Id = col_double(),
## gridcode = col_double(),
## Shape_Length = col_double(),
## Shape_Area = col_double(),
## ClassName = col_character(),
## Area_Sq_Km = col_double(),
## Percent = col_double(),
## Date = col_double()
## )
dc2020_new <- read_csv("dc2020_new.csv")
##
## -- Column specification --------------------------------------------------------
## cols(
## Country = col_character(),
## OID_ = col_double(),
## Id = col_double(),
## gridcode = col_double(),
## Shape_Length = col_double(),
## Shape_Area = col_double(),
## ClassName = col_character(),
## Area_Sq_Km = col_double(),
## Percent = col_double(),
## Date = col_double()
## )
hispaniola_2020 <- rbind (haiti2020, dc2020_new)
plot3 <- ggplot (data = hispaniola_2020, aes (x = Percent,
y = ClassName, fill = Country))+
geom_col(position = "dodge")+
theme_bw()
ggplotly(plot3)