Attaching package: 'plotly'
The following object is masked from 'package:ggplot2':
last_plot
The following object is masked from 'package:stats':
filter
The following object is masked from 'package:graphics':
layout
nations <-read_csv("nations.csv")
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.
nations <-mutate(nations, GDP = (gdp_percap * population) / (10^12))filtered <-filter(nations, country =="China"| country =="Germany"| country =="Japan"| country =="United States")
plot1 <-ggplot(filtered, aes(x = year, y = GDP, color = country)) +geom_point() +geom_line() +labs(title ="China's Rise to Become the Largest Economy",x ="year",y ="GDP ($ trillion)") +scale_color_brewer(palette ="Set1")plot1