gdp_countries | R Documentation |
From World Bank, GDP in current U.S. dollars 1960-2020 by decade
gdp_countries
A data frame with 659 rows and 9 variables.
Name of country.
description of data: GDP (in current US$), GDP growth (annual %), GDP per capita (in current US$)
value in 1960
value in 1970
value in 1980
value in 1990
value in 2000
value in 2010
value in 2020
library(dplyr)
# don't use scientific notation
options(scipen = 999)
# List the top 10 countries by GDP (There is a row for World)
gdp_countries |>
filter(description == "GDP") |>
mutate(year2020 = format(year_2020, big.mark = ",")) |>
select(country, year2020) |>
arrange(desc(year2020)) |>
top_n(n = 11)
# List the 10 countries with the biggest GDP per capita change from 1960 to 2020
gdp_countries |>
filter(description == "GDP per capita") |>
mutate(change = format(round(year_2020 - year_1960, 0), big.mark = ",")) |>
select(country, change, year_1960, year_2020) |>
na.omit() |>
arrange(desc(change)) |>
top_n(n = 10)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.