Skip to content
Prev 5703 / 398506 Next

How do I add fitted curves to coplots?

On Tue, 16 May 2000, John S. Walker wrote:

            
You need to fake it. There is an example in the 3rd edition R scripts,
which for the Rabbit data becomes

coplot(seq(0,40, len=60) ~ log(Dose) | Animal * Treatment, Rabbit,
       show.given=FALSE,
       panel = function(x, y, ...) {
           ind <- round(1 + 59*y/40)
           lines(spline(x, fitted(R.nlme2)[ind]))
           points(x, Rabbit$BPchange[ind])
       })

coplot does not have the subscripts = T argument that Trellis has.
I think we could usefully add it (since `lattice' seems nowhere visible
yet), and I will do so for 1.1.0.  Also, the handling of xlab/ylab differs
a bit from the S original, and I will take a look.