vec_inc <- c(1:10)
vec_dec<- c(10:1)
vec_ran <- c(sample(1:10))
vec_flat <- rep.int(1,10)
increasing(vec_inc)
increasing(vec_dec)
increasing(vec_ran)
increasing(vec_flat)
decreasing(vec_inc)
decreasing(vec_dec)
decreasing(vec_ran)
decreasing(vec_flat)
unvarying(vec_inc)
unvarying(vec_dec)
unvarying(vec_ran)
unvarying(vec_flat)
library(ggplot2)
library(gghighlight)
library(dplyr)
heights_mono <- heights %>%
features(height_cm, feat_monotonic) %>%
left_join(heights, by = "country")
ggplot(heights_mono,
aes(x = year,
y = height_cm,
group = country)) +
geom_line() +
gghighlight(increase)
ggplot(heights_mono,
aes(x = year,
y = height_cm,
group = country)) +
geom_line() +
gghighlight(decrease)
heights_mono %>%
filter(monotonic) %>%
ggplot(aes(x = year,
y = height_cm,
group = country)) +
geom_line()
heights_mono %>%
filter(increase) %>%
ggplot(aes(x = year,
y = height_cm,
group = country)) +
geom_line()
Run the code above in your browser using DataLab