[R] About Tcl/Tk after command in R

Duncan Murdoch murdoch at stats.uwo.ca
Thu Jan 15 16:52:40 CET 2009


On 1/15/2009 10:18 AM, davide.massidda at unipd.it wrote:
> Dear R-helpers,
> I have a problem with the tcl "after" instruction. When I send:
> 
>> library(tcltk)
> Loading Tcl/Tk interface ... done
> 
>> tcl("after",1000,cat("try tcl after\n"))
> try tcl after
> <Tcl>
> 
> the tcl command works fine. Similarly, the tcl command:
> 
>> tcl("after",1000,plot(rnorm(100)))
> <Tcl>
> 
> works fine. But, if I send the command:
> 
>> tcl("after",1000,10^2)
> <Tcl> after#0
> 
> appears a popup window which reports:
> 
> Error: invalid command name “100”
> 
> Why?

The value of cat("something") is NULL, the value of plot(something) is 
NULL, but the value of 10^2 is 100.  You're trying to execute no Tcl 
command in the first two cases, but you're trying to execute the command 
"100" in the last, and that's not a legal Tcl command.

Duncan Murdoch




More information about the R-help mailing list