I made an RShiny application with graph using ggplot.
Now I want to add the middle row to the existing plot.
library(ggplot2)
A <- c(1:10)
B <- c(1,1,2,2,3,3,4,4,5,5)
donnees <- data.frame(A,B)
datetime<-donnees[,2]
Indcatotvalue<-donnees[,1]
df<-donnees
mn<-tapply(donnees[,1],donnees[,2],mean)
moyenne <- data.frame(template=names(mn),mean=mn)
ggplot(data=df,
aes_q(x=datetime,
y=Indcatotvalue)) + geom_line()
I tried to add:
geom_line(aes(y = moyenne[,2], colour = "blue"))
or:
lines(moyenne[,1],moyenne[,2],col="blue")
but nothing happens :( I especially do not understand the function of the "line".
Thanks for your reply...
source
share