[Rd] lattice bug? (PR#2765)

david.barron at said-business-school.oxford.ac.uk david.barron at said-business-school.oxford.ac.uk
Fri Apr 11 20:11:37 MEST 2003


I've been experimenting with the lattice graphics in chapter 3 of MASS.  The
code to produce figure 3.14 is:

data(crabs)
library(mva)
lcrabs.pc <- predict(princomp(log(crabs[,4:8])))
crabs.grp <- c("B", "b", "O", "o")[rep(1:4, rep(50,4))]
splom( ~lcrabs.pc[, 1:3], groups = crabs.grp,
   panel = panel.superpose,
   key = list(text = list(c("Blue male", "Blue female",
                           "Orange Male", "Orange female")),
       points = Rows(trellis.par.get("superpose.symbol"), 1:4),
       columns = 4)
  )

This fails with the error: Error in 1:ncol(x) : NA/NaN argument

I traced this to the line in the splom function:

   for (j in 1:ncol(x)) id.na <- id.na | is.na(x[, j])

but the root of the problem actually seems to be earlier, when
latticParseFormula is called.

 form <- if (inherits(formula, "formula"))
        latticeParseFormula(formula, data)
    x <- as.data.frame(form$right)

This seems not to work properly if data=parent.frame().  Should it?
Apologies if this is something known, or if I'm doing something wrong!

I'm using R 1.6.2 under Windows 2000 Pro and lattice Version: 0.7-1 Date:
2003/03/15.

Thanks,
David

===================================================
David Barron
Jesus College
Oxford OX1 3DW
01865 279684



More information about the R-devel mailing list