plot.new has not been called yet

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(x, y), type = type, ...) : plot.new has not been called yet

Leave a Comment