Re: [R] Conditionally Updating Lattice Plots

2008-07-21 Thread Deepayan Sarkar
On 7/20/08, Bryan Hanson [EMAIL PROTECTED] wrote: Hi All... I can¹t seem to find an answer to this in the help pages, archives, or Deepayan¹s Lattice Book. I want to do a Lattice plot, and then update it, possibly more than once, depending upon some logical options. Code below; it

[R] Conditionally Updating Lattice Plots

2008-07-20 Thread Bryan Hanson
Hi All... I can¹t seem to find an answer to this in the help pages, archives, or Deepayan¹s Lattice Book. I want to do a Lattice plot, and then update it, possibly more than once, depending upon some logical options. Code below; it produces a second plot page when the second update is called,

Re: [R] Conditionally Updating Lattice Plots

2008-07-20 Thread Gabor Grothendieck
Try this: library(lattice) fancy.lm - function(x, y, fit = TRUE, resid = TRUE){ model - lm(y ~ x) y.pred - predict(model) # Compute residuals for plotting res.x - as.vector(rbind(x, x, rep(NA,length(x # NAs induce breaks in line res.y - as.vector(rbind(y,