library(gapminder)  
library(ggpubr)  

cor(gapminder$lifeExp, gapminder$gdpPercap, method = "pearson")
cor(gapminder$lifeExp, gapminder$gdpPercap, method = "spearman") 

europe <- gapminder %>% filter(continent == "Europe") %>% pull(lifeExp) 
africa <- gapminder %>% filter(continent == "Africa") %>% pull(lifeExp) 
t.test(europe, africa) 

model <- lm(lifeExp ~ gdpPercap, data = gapminder) 
summary(model) 

model_multi <- lm(lifeExp ~ gdpPercap + year + continent, data = gapminder)
summary(model_multi)

