Lets take the following data.frame as an example:
data <- data.frame(windowSize1=rep(c("1 week","2 weeks"),each=6),
windowSize2 = rep(c("0 weeks","1 week"),6),
Modell = rep(c("SVM","random Forest","NN"), 4),
MSE=c(rnorm(12))
)
ggplot()+
geom_point(data=data, aes(x=windowSize1, y=MSE, color=Modell, shape=windowSize2),size=2)
I want to add to this plot a line connecting the MSE value of row 1 in the data and of row 7 in the same color of the reelated SVM - datapoints. But when I try:
ggplot()+
geom_point(data=data, aes(x=windowSize1, y=MSE, color=Modell, shape=windowSize2),size=2)+
geom_line(data=data[c(1,7),],aes(x=windowSize1, y=MSE, color=Modell) )
I get the error method: "geom_path: Each group consists of only one observation. Do you need to adjust the group aesthetic?"
Does anyone understand this message? (I don't understand it, because both rows of the data.frame are from the Group "SVM")