Rows: 5275 Columns: 10
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (5): iso2c, iso3c, country, region, income
dbl (5): year, gdp_percap, population, birth_rate, neonat_mortal_rate
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
library(ggplot2)library(dplyr)
Attaching package: 'dplyr'
The following objects are masked from 'package:stats':
filter, lag
The following objects are masked from 'package:base':
intersect, setdiff, setequal, union
graph1 <- nations2 |>filter(country ==c("Singapore", "Korea, Rep.", "Oman", "Romania")) |>ggplot(aes(x = year, y = gdp, col = country)) +geom_point(size =2)+geom_line()+scale_color_brewer(palette ="Set1")+theme_minimal()+labs(x ="Year", y ="GDP ($ Trillion)", title ="South Korea Stands Out in GDP Growth")
Warning: There was 1 warning in `filter()`.
ℹ In argument: `country == c("Singapore", "Korea, Rep.", "Oman", "Romania")`.
Caused by warning in `country == c("Singapore", "Korea, Rep.", "Oman", "Romania")`:
! longer object length is not a multiple of shorter object length
graph1
# I chose these specific countries because they've all experienced radical increases in their economic growth within the past 50-60 years. Despite them all experiencing significant changes compared to their own previous economies, I wanted to see how they compared to each other on the global scale.# Source: https://ourworldindata.org/economic-growth-since-1950
Graph 2
graph2 <- nations2 |>group_by(region, year) |>summarise(sum_gdp =sum(gdp)) |>ggplot(aes(x = year, y = sum_gdp, fill = region))+geom_area(color ="white")+scale_fill_brewer(palette ="Set2")+theme_minimal()+labs(x ="Year", y ="GDP ($ Trillion)", title ="GDP by World Bank Region")
`summarise()` has grouped output by 'region'. You can override using the
`.groups` argument.