Hello everyone,
I'm very new in R using and trying to explore about this software.I am seeking the advice that how can I average the data based on variable then draw line graphs?
For example, I have a data frame named mydata like this:
Cultivar Period Height
Cultivar A 1 32
Cultivar A 1 23
Cultivar B 1 34
Cultivar B 1 43
Cultivar C 1 43
Cultivar C 1 43
Cultivar A 2 24
Cultivar A 2 43
Cultivar B 2 32
Cultivar B 2 23
Cultivar C 2 33
Cultivar C 2 34
Cultivar A 3 23
Cultivar A 3 33
Cultivar B 3 44
Cultivar B 3 32
Cultivar C 3 42
Cultivar C 3 42
I want to draw the line graph in which x-axis presented by "Period"(3 periods), y-axis is "plant height" and the graph is filled by Cultivar.
I have tried this coding:
data<-mydata %>% group_by(Cultivar) %>% summarize(averaged.ES=mean(Height), sd.ES=sd(Height))
Because I want to average the data based on Cultivar first, but the graph was showing sawtooth pattern.
Your advice would be very appreciated!
Thank you very much!