[R] Tcl Tk table

Peter Wolf s-plus at wiwi.uni-bielefeld.de
Fri Apr 23 17:50:20 CEST 2004


thsudler at swissonline.ch wrote:

>Hi 
>
>I've a problem with the following example:
>
>library(tcltk)
>.Tcl("array unset tclArray")
>
>myRarray <- matrix(1:1000, ncol=20)
>
>for (i in (0:49))
>  for (j in (0:19))
>     .Tcl(paste("set tclArray(",i,",",j,") ",myRarray[i+1,j+1],sep=""))
>     
>tt<-tktoplevel()
>
>table1 <- tkwidget(tt,"table",variable="tclArray", rows="50", cols="50")
>
>tkpack(table1)
>
>#Old version which worked in R 1.6 but it doesn't work with R 1.9 (and also not with 1.8), why??
>.....
>Under R version 1.6 I had no problem. Now I installed R 1.9 (with ActiveTcl) and my program doesn't work. ...
>Thomas
>
>______________________________________________
>R-help at stat.math.ethz.ch mailing list
>https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>  
>
Are you sure?

 > library(tcltk)
 > .Tcl("array unset tclArray")
<Tcl>
 >
 > myRarray <- matrix(1:1000, ncol=20)
 >
 > for (i in (0:49))
+   for (j in (0:19))
+      .Tcl(paste("set tclArray(",i,",",j,") ",myRarray[i+1,j+1],sep=""))
 >
 > tt<-tktoplevel()
 >
 > table1 <- tkwidget(tt,"table",variable="tclArray", rows="50", cols="50")
Error in structure(.External("dotTcl", ..., PACKAGE = "tcltk"), class = 
"tclObj") :
        [tcl] invalid command name "table".
 >
 > version
         _
platform i686-pc-linux-gnu
arch     i686
os       linux-gnu
system   i686, linux-gnu
status
major    1
minor    6.2
year     2003
month    01
day      10
language R

the error occurs with version 1.6.2, too.

Some debugging shows: the error message comes from tcl/tk and
you need some additional features to be allowed to use the table-widget!
you have to include:

tclRequire("Tktable")

... and all is ok for 1.8.1 and I also hope for 1.9.0.

see: http://bioinf.wehi.edu.au/~wettenhall/RTclTkExamples/tktable.html

Peter Wolf




More information about the R-help mailing list