# Load and filter GapMinder datagap <-read.csv("gapminderData5.csv")gap07 <- gap %>%filter(year ==2007& continent !="Oceania")# Scatter Plot with regression line and correlationp1 <-ggscatter(gap07, x ="gdpPercap", y ="lifeExp", col ="continent",xlab ="GDP per capita ($)", ylab ="Life Expectancy (yrs)",main ="GapMinder Data 2007", add ="reg.line", conf.int =TRUE) +xscale("log10", .format =TRUE) +stat_cor(aes(color = continent), method ="spearman")print(p1)
# Histogram of Life Expectancy by Continentp2 <-gghistogram(gap07, x ="lifeExp", fill ="continent", palette ="npg", bins =20)print(p2)
# Violin Plot with Boxplot and Jitterp3 <-ggviolin(gap07, x ="continent", y ="lifeExp", fill ="continent", palette ="jco",add =c("boxplot", "jitter"), ylab ="Life expectancy (yrs)")print(p3)