library(ggplot2)
library(brolgar)
heights %>%
sample_frac_keys(size = 0.1) %>%
stratify_keys(10) %>%
ggplot(aes(x = height_cm,
y = year,
group = country)) +
geom_line() +
facet_wrap(~.strata)
# now facet along some feature
library(dplyr)
heights %>%
key_slope(height_cm ~ year) %>%
right_join(heights, ., by = "country") %>%
stratify_keys(n_strata = 12,
along = .slope_year,
fun = median) %>%
ggplot(aes(x = year,
y = height_cm,
group = country)) +
geom_line() +
facet_wrap(~.strata)
heights %>%
stratify_keys(n_strata = 12,
along = height_cm) %>%
ggplot(aes(x = year,
y = height_cm,
group = country)) +
geom_line() +
facet_wrap(~.strata)
Run the code above in your browser using DataLab