# Use this R-Chunk to import all your datasets!
finance <- ourworldindata::financing_healthcare %>%
filter(year > 1825) %>%
filter(!is.na(child_mort)) %>%
filter(!is.na(gdp)) %>%
select(year, country, continent, child_mort, health_insurance, gdp, health_exp_total, health_exp_public, health_exp_private)
#View(finance)
The Our World in Data website has world data. It is nice that they have provided graphics and then the data that they used to generate the graphics. Once again, we are going to build visualizations in R using their data.
[X] Take notes on your reading of the specified ‘R for Data Science’ chapter in the Rmd
[X] Explore the world data on financing_healthcare and create an interesting graphic that highlights this dataset in relation to child mortality.
[X] Push your .Rmd, .md, and .html to your GitHub repo
ggplot(data = finance, aes(x = year, y = child_mort, by = country, size = health_exp_total)) +
geom_line(aes(group = country, color = health_exp_public)) +
geom_point(aes(group = country, color = health_exp_public)) +
facet_wrap(~continent) + theme_minimal()
ggplot(data = finance, aes(x = year, y = child_mort, by = country, size = health_exp_total)) +
geom_line(aes(group = country, color = health_exp_private)) +
geom_point(aes(group = country, color = health_exp_private)) +
facet_wrap(~continent) + theme_minimal()
faithful %>% ggplot() +
geom_histogram(aes(eruptions), color = "white") +
labs(x = "Length", y = "Frequency", title = "OldFaithful")
faithful %>% mutate(
wait_long = case_when(
waiting >= 65 ~ "long",
waiting <= 20 ~ "real short",
TRUE ~ "short")) %>%
ggplot(mapping = aes(fill = wait_long)) +
geom_histogram(mapping = aes(eruptions), color = "white") +
labs(x = "Length", y = "Frequency", title = "OldFaithful") +
theme_bw()
# faithful %>% mutate(
# wait_long = case_when(
# waiting >= 65 ~ "long",
# waiting <= 20 ~ "real short",
# TRUE ~ "short")) %>%
# ggplot(mapping = aes(fill = wait_long)) +
# geom_hexbin(mapping = aes(x = eruptions, y = wait_long), color = "white") +
# labs(x = "Length", y = "Wait_time", title = "OldFaithful") +
# theme_bw()