[Rd] Error in grid.text after tcltk package loaded

Erik Iverson iverson at biostat.wisc.edu
Tue Feb 5 21:18:17 CET 2008


Hello -

I am noticing some strange errors when using the grid package, but 
(apparently) only after loading the tcltk package.  The interaction here 
does not make sense to me, and I'm wondering if anyone else can 
reproduce this, or if it is specific to my setup.  Here is my sessionInfo:

sessionInfo()
R version 2.6.2 RC (2008-02-04 r44332)
i686-pc-linux-gnu

locale:
LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=en_US.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C

attached base packages:
[1] tcltk     grid      stats     graphics  grDevices utils     datasets
[8] methods   base

This also happens to me in R 2.6.1. I'm running Linux (RHEL 4) on a 
32-bit Intel CPU and using KDE.  These are R versions that I have 
compiled myself.

I try the following in R (started with --vanilla), this is the simplest 
code I have to reproduce the problem on my end.

## Start R Code

library(grid)
library(tcltk)
grid.text("a", x = seq(0,1, by = .001))

## End R Code

The graphic draws to my X11 device, however, when I try to move the X11 
R Graphics Device window with my mouse and 'drop' it somewhere by 
releasing the mouse button, I get errors like the following:

 > Error in grid.Call.graphics("L_text", as.graphicsAnnot(x$label), x$x, 
  : invalid color name
 > Error in grid.Call.graphics("L_text", as.graphicsAnnot(x$label), x$x, 
  : REAL() can only be applied to a 'numeric', not a 'NULL'
 > Error in grid.Call.graphics("L_text", as.graphicsAnnot(x$label), x$x, 
  : VECTOR_ELT() can only be applied to a 'list', not a 'integer'
 > Error in grid.Call.graphics("L_text", as.graphicsAnnot(x$label), x$x, 
  : REAL() can only be applied to a 'numeric', not a 'character'
 > Error in grid.Call.graphics("L_text", as.graphicsAnnot(x$label), x$x, 
  : REAL() can only be applied to a 'numeric', not a 'NULL'
 > Error in grid.Call.graphics("L_text", as.graphicsAnnot(x$label), x$x, 
  : REAL() can only be applied to a 'numeric', not a 'char'
In addition: Warning message:
In grid.Call.graphics("L_text", as.graphicsAnnot(x$label), x$x,  :
   supplied color is not numeric nor character

My traceback always looks like this:
 > traceback()
5: .Call.graphics(fnname, ..., PACKAGE = "grid")
4: grid.Call.graphics("L_text", as.graphicsAnnot(x$label), x$x,
        x$y, resolveHJust(x$just, x$hjust), resolveVJust(x$just,
            x$vjust), x$rot, x$check.overlap)
3: drawDetails.text(x, recording = FALSE)
2: drawDetails(x, recording = FALSE)
1: drawGrob(x)

I can only get these messages to happen after loading the tcltk package, 
using grid.text, with 'many' text strings (happens rarely with 100, 
almost every move with 1000 strings as in my example).

I found just one reference to a similar error message in the archives, 
although not to do with grid. Here's a link:

https://stat.ethz.ch/pipermail/r-devel/2008-January/048117.html

Can anyone else replicate this? Any ideas on what's going on?

Best,
Erik Iverson



More information about the R-devel mailing list