0% found this document useful (0 votes)
20 views1 page

Tidyverse GDP Analysis by Continent

This document shows code using the tidyverse package in R to analyze GDP data from the Gapminder dataset. The code groups the data by continent and year, calculates the median GDP per capita for each group, and uses ggplot2 to create a scatter plot of median GDP versus year, colored by continent and setting the y-axis lower limit to 0.

Uploaded by

Kenneth Sablay
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views1 page

Tidyverse GDP Analysis by Continent

This document shows code using the tidyverse package in R to analyze GDP data from the Gapminder dataset. The code groups the data by continent and year, calculates the median GDP per capita for each group, and uses ggplot2 to create a scatter plot of median GDP versus year, colored by continent and setting the y-axis lower limit to 0.

Uploaded by

Kenneth Sablay
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Sablay, Kenneth Bryan M.

7-13-19
DS100-2

MP03 (TIDYVERSE)
A.

B.
C.
> by_year_continent = gapminder %>%
group_by(continent, year) %>%
summarize(medianGdpPercap = median(gdpPercap))
> ggplot(by_year_continent, aes(x = year, y = medianGdpPercap,color =
continent), geom_point(), expand_limits(y = 0))

You might also like