library(wbstats)
str(wb_cachelist, max.level = 1) # Finding available data
## List of 8
## $ countries : tibble [304 × 18] (S3: tbl_df/tbl/data.frame)
## $ indicators : tibble [16,649 × 8] (S3: tbl_df/tbl/data.frame)
## $ sources : tibble [63 × 9] (S3: tbl_df/tbl/data.frame)
## $ topics : tibble [21 × 3] (S3: tbl_df/tbl/data.frame)
## $ regions : tibble [48 × 4] (S3: tbl_df/tbl/data.frame)
## $ income_levels: tibble [7 × 3] (S3: tbl_df/tbl/data.frame)
## $ lending_types: tibble [4 × 3] (S3: tbl_df/tbl/data.frame)
## $ languages : tibble [23 × 3] (S3: tbl_df/tbl/data.frame)
wbsearch("gdp growth")
## indicatorID indicator
## 676 5.51.01.10.gdp Per capita GDP growth
## 679 6.0.GDP_growth GDP growth (annual %)
## 7128 GFDD.OI.19 Banking crisis dummy (1=banking crisis, 0=none)
## 9961 NV.AGR.TOTL.ZG Real agricultural GDP growth rates (%)
## 10162 NY.GDP.MKTP.KD.ZG GDP growth (annual %)
## 10165 NY.GDP.MKTP.KN.87.ZG GDP growth (annual %)
#choose NY.GDP.MKTP.KD.ZG
library(wbstats)
library(ggplot2)
library(dplyr)
library(sf)
# Get gross domestic product per capita data for all countries from 1960 to 2022
gdp <- wb(country = "all", indicator = "NY.GDP.MKTP.KD.ZG", startdate = 2016, enddate = 2022)
# world country polygons 'medium' scale
world_geo <- rnaturalearth::ne_countries(scale = 50, returnclass = "sf")
gdp_geo <- left_join(world_geo, gdp, by = c("iso_a2" = "iso2c"))
library(ggplot2)
library(viridis)
library(gridExtra)
year <- seq(min(gdp$date),max(gdp$date))
map <- list()
for (i in year) {
p <- ggplot(subset(gdp_geo,date == i)) +
geom_sf(aes(fill = value)) +
scale_fill_viridis("value") +
labs(title = paste("Annual GDP Growth in", i))
t <- which(year == i)
# add the plot to the list
map[[t]]<- p
}
grid.arrange(grobs = map)
From the GDP growth rate map between 2018 and 2020, it is evident that the COVID-19 pandemic had a significant impact on the global economy. The map clearly shows that the GDP growth rate suffered a substantial decrease during this period, as a result of the pandemic’s widespread impact on various sectors. However, the economy appears to have started its recovery from the year 2021.
library(gtrendsR)
library(reshape2)
TikTok = gtrends(c("TikTok hearing"), gprop = "web",geo = c("US"), time = "today 3-m")[[1]]
TikTok = dcast(TikTok, date ~ keyword + geo, value.var = "hits")
#plot
library(ggplot2)
library(ggthemes)
g <- ggplot(data= TikTok) +
geom_line(aes(x=date, y=`TikTok hearing_US`)) +
ylim(0, max(TikTok$`TikTok hearing_US`))+
labs(titles = "Google Trends for TikTok hearing hearing past 90 days in the US")+ ylab("Searches") + xlab("date")
g
The Google Trends data analysis reveals an interesting trend regarding the TikTok hearing that took place on March 23. Starting from the beginning of March, the search volume for TikTok began to rise gradually, leading up to the date of the hearing. However, after March 23, there was a significant and rapid increase in the search volume for TikTok. This indicates that the hearing may have had a substantial impact on public interest and awareness of TikTok, resulting in a surge of online searches for the platform.