Let us analyze the growth rates of G7 Member Economies from 1960 to around 2020 (as per data availability)
G7 Members are Canada, France, Germany, Italy, Japan, UK and US
Data is taken from Kaggle GDP annual growth for each country (1960 - 2020)
gdp.growth <- read.csv("GDP_annual_growth.csv")
g7 <- c("CAN","FRA","DEU","ITA","JPN","GBR","USA")
gdp.growth <- gdp.growth[gdp.growth$Country.Code %in% g7,]
gdp.growth <- gdp.growth[c(1:2,5:(ncol(gdp.growth)-2))]
colnames(gdp.growth)[1:2] <- c("country_name","country_code")
df <- gdp.growth %>% gather(time,gdp,-c(country_name,country_code))
df$country_code <- as.factor(as.character(df$country_code))
df$time <- as.factor(as.numeric(gsub("X","",df$time)))