library(dplyr)library(ggplot2)library(readr)# Set the correct working directorysetwd("~/Documents/Data 101/:Users:terrymensah:Documents:Data 101")# Import the Nations datasetnations <-read_csv("nations.csv", skip =1)
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.
p2 <- nations2 |>ggplot(aes(x = year, y = GDP /1e12,color = region)) +geom_point() +geom_line() +scale_color_brewer(palette ="Set2") +labs(title ="GDP by Region Over Time",x ="Year",y ="Total GDP (Trillions)",color ="Region" ) p2