[R] Lattice graphics: adding lines to a plot

2004-07-29 Thread Matthew Walker
I am trying to use the Lattice package to produce the same result as I can with the base graphics. With base graphics I can type: x - 1:100 y - x+rnorm(length(x)) g - lm( y ~ x ) model.y - g$coef[1]+g$coef[2]*x plot(x,y) # a plot of the data lines( x, model.y ) # a plot of the model,

Re: [R] Lattice graphics: adding lines to a plot

2004-07-29 Thread Chuck Cleland
How about this? library(lattice) xyplot(y ~ x, panel = function(x, y, ...){ panel.xyplot(x, y, ...) panel.lmline(x, y, type=l) }) Matthew Walker wrote: I am trying to use the Lattice package to produce the

Re: [R] Lattice graphics: adding lines to a plot

2004-07-29 Thread Deepayan Sarkar
On Thursday 29 July 2004 06:37, Chuck Cleland wrote: How about this? library(lattice) xyplot(y ~ x, panel = function(x, y, ...){ panel.xyplot(x, y, ...) panel.lmline(x, y, type=l) }) That should