[R] console from tcltk

Peter Dalgaard P.Dalgaard at biostat.ku.dk
Wed May 14 15:17:42 CEST 2008


Gabor Grothendieck wrote:
> Is it possible to use the console from within tcltk?
>
>   
Not on Windows RGui, not without deeper magic, anyway (your examples
work quite happily in a terminal on Linux). If you can figure out how to
wire a Tcl channel to the R console, then I suppose it could be made to
work.

What might be easier to implement (currently it does not work) would be
something like

tcl(cat, "Hello, World")

It almost works:

> .Tcl(paste(.Tcl.callback(cat), "foo\\n"))                   
foo
<Tcl>
>

..but apparently there is a discrepancy between the single-string return
value from   .Tcl.callback(cat) and what .Tcl.objv expects.               
>>  library(tcltk)
>> tcl("puts", "stdout", "Hello, World")
>>     
> Error in structure(.External("dotTclObjv", objv, PACKAGE = "tcltk"),
> class = "tclObj") :
>   [tcl] can not find channel named "stdout".
>   
>> .Tcl('puts stdout "Hello, World"')
>>     
> Error in structure(.External("dotTcl", ..., PACKAGE = "tcltk"), class
> = "tclObj") :
>   [tcl] can not find channel named "stdout".
>   
>> R.version.string  # Windows Vista
>>     
> [1] "R version 2.7.0 RC (2008-04-17 r45367)"
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>   


-- 
   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark      Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)              FAX: (+45) 35327907



More information about the R-help mailing list