Hi, welcome!
Is this what you are trying to do?
# Library calls
library(tidyverse)
# Sample data on a copy/paste friendly format
mydata <- data.frame(
stringsAsFactors = FALSE,
Cultivar = c("A","A","B","B","C","C",
"A","A","B","B","C","C","A","A","B","B","C","C"),
Period = c(1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3),
Height = c(32,23,34,43,43,43,24,43,
32,23,33,34,23,33,44,32,42,42)
)
# Relevant code
mydata %>%
group_by(Period,Cultivar) %>%
summarise(mean_heigh = mean(Height, na.rm = TRUE)) %>%
ggplot(aes(x = Period, y = mean_heigh, color = Cultivar)) +
geom_line()
Created on 2020-02-13 by the reprex package (v0.3.0.9001)
If this doesn't solve your problem, please provide a proper REPRoducible EXample (reprex) illustrating your issue.