[R] warning messages in grid or lattice give that I can't debug

Deepayan Sarkar deepayan.sarkar at gmail.com
Fri Aug 3 04:04:38 CEST 2007


On 8/2/07, Richard M. Heiberger <rmh at temple.edu> wrote:
> The messages are visible in 2.6.0dev
> The same commands in 2.4.1 work without warning messages.
> I am using the HH_1.18-1 from R_2.4.1 with both R versions and not
> the current HH_2.1-3
>
> version$version.string
> installed.packages()[c("grid","lattice", "HH"),3]
> ## library(HH)
> library(lattice, lib.loc="C:/PROGRA~1/R/R-2.4.1/library")
> hotdog <- read.table(hh("datasets/hotdog.dat"), header=TRUE)
> ancova(Sodium ~ Calories + Type, data=hotdog)
>
>
> the messages in R_2.6.0dev are
> Warning messages:
> 1: In grid.Call.graphics("L_points", x$x, x$y, x$pch, x$size) :
>   supplied color is not numeric nor character
> ...
> 6: In grid.Call.graphics("L_points", x$x, x$y, x$pch, x$size) :
>   supplied color is not numeric nor character
>
>
> My guess is that these warnings are a response to a change in grid or lattice
> in 2.5.0.  I attempted to trace these with
> options(warn=2)
> options(error=recover)
> without success.
>
> Debugging suggestions or revised programming suggestions would be appreciated.

Well, options(warn=2) traces the problem to the legend drawing code,
and going from there, I get

> str(trellis.last.object()$legend$right$args$key$points)
'data.frame':   3 obs. of  6 variables:
 $ alpha: num  1 1 1
 $ cex  : num  0.8 0.8 0.8
 $ col  : chr  "#0080ff" "#ff00ff" "darkgreen"
 $ font : num  1 1 1
 $ pch  : num  1 1 1
 $ fill : Factor w/ 1 level "transparent": 1 1 1

Note that the last component 'fill' is a factor (which is "not numeric
nor character", at least in a zen kind of way). I presume you are
somehow protecting 'col' from becoming a factor, and that does not
translate to 'fill'.

This behaviour (of HH) is not new, and I believe you will see the same
output as above in R 2.4. What's new is that 'fill' used to be ignored
by draw.key(), which was a bug in lattice that has now been fixed.

-Deepayan



More information about the R-help mailing list