[R] MacOS R and tcltk

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Mon Sep 10 12:06:53 CEST 2001

Steve Cassidy <steve.cassidy at mq.edu.au> writes:

> From what I can glean from the sources and bundled packages, the tcltk 
> package isn't built by default for the MacOS port of R.  Looking at the code 
> there doesn't seem to be any real reason not to do this except that perhaps 
> tcl/tk isn't available on the builders machine.  Is this the case?

Probably the real reason is that the people who did the tcltk package
(i.e. mainly me with assistance from Brian Ripley on Windows) haven't
understood the event loop integration issues on Mac well enough.

Actually I'm not at all sure the way we do it on the other two
platforms is all that hot. We ought to understand the "notifier"
concept better and use it in the same way that the main loops of the
three flavours of Tcl_MainLoop does, or maybe setup a notifier
structure for R itself and use that as the event source for
Tcl_MainLoop itself (or any other GUI loop we might be running with).

> Since I have a need for cross platform access to tcltk from R, and since I 
> have one of the Mac Tcl maintainers working with me, I plan to build this 
> package at least for our own purposes.  I can make it available to others if 
> there is a demand.  

That would be most welcome.

> I also wonder whether anyone has done anything about passing data between tcl 
> and R. I need to pass lists of things back and forth and although it seems I 
> can do this via strings it will introduce a lot of overhead when they are 
> long.  I haven't looked at R internals much but would it be hard to code for 
> special cases like passing a vector of strings or a vector of doubles? 

It's fairly easy to get hold of the internal data structures in R and
as far as I can see also to copy them to and from Tcl objects using
Tcl_SetDoubleObject, Tcl_SetVar and friends. You'd need to read the R
Extensions manual for the details.

   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list