I have seen the question already asked... and solved adding stat = \"identity\" to geom_bar.
But in my case, this does not solve anything (I still
the error was because the geom_line() or geom_point() option was not added. You can directly plot it without saving it as object on adding this option.
The error message is due to fact that you didn't save d+geom_line() as an object.
#Save ggplot() as object
d <- ggplot(data=data3, aes(x=MonthNB, y=Ptot, colour=StationNAME))
#Add to d geom_line() - this makes the plot to appear on the screen but not saved.
d + geom_line()
To save layer to object
d<-d+geom_line()
#No error message
d