Why does this happen?
plot(x,y)
yx.lm <- lm(y ~ x)
lines(x, predict(yx.lm), col=\"red\")
Error in
plot.xy(xy.coords
In my case, I was trying to call plot(x, y) and lines(x, predict(yx.lm), col="red") in two separate chunks in Rmarkdown file. It worked without problems when running chunk by chunk, but the corresponding document wouldn't knit. After I moved all plotting calls within one chunk, problem was resolved.