Re: [R] console from tcltk

From: Peter Dalgaard <P.Dalgaard_at_biostat.ku.dk>
Date: Wed, 14 May 2008 15:17:42 +0200

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

______________________________________________
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.
Received on Wed 14 May 2008 - 16:30:30 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 14 May 2008 - 17:30:37 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive