library(tidyverse) npk %>% ggplot(aes(block, yield)) + stat_summary(aes(group = P, lty = P), fun.y = "mean", geom = "line")