Skip to content

R TclTk Examples

3 messages · James Wettenhall, Christian Schulz, Peter Dalgaard

#
Hi,

I've been learning how to use R TclTk in Windows over the last 
few months.  

I have recently put together a collection of examples of 
some common widgets and their corresponding R code, at

http://bioinf.wehi.edu.au/~wettenhall/RTclTkExamples/

I would be interested in any feedback - Is it useful? Does it 
contain any significant errors or bad coding style?  Does anyone 
else want to contribute similar examples with screenshots?

Regards,
James

--------------------------------------------------------------------------
James Wettenhall                                  Tel: (+61 3) 9345 2629
Division of Genetics and Bioinformatics           Fax: (+61 3) 9347 0852
The Walter & Eliza Hall Institute         E-mail: wettenhall at wehi.edu.au
 of Medical Research,                     Mobile: (+61 / 0 ) 438 527 921    
1G Royal Parade,
Parkville, Vic 3050, Australia
http://www.wehi.edu.au
#
many thanks for this contribution, perhaps
i add in near future some snippets with your starting points!

..here is one simple, but nice for anybody works often with spss-data.
regards,christian


getfile <- function()  {
    name <- tclvalue(tkgetOpenFile(filetypes="{{SPSS Files} {.sav}} {{All
files} *}"))
    if (name=="") return;
    zz <- read.spss(name,use.value.label=T,to.data.frame=T)
    assign("myData",zz,envir=.GlobalEnv)
}
tt <- tktoplevel()
button.widget <- tkbutton(tt,text="Select SPSS File",command=getfile)
tkpack(button.widget)
#
James Wettenhall <wettenhall at wehi.edu.au> writes:
Just a few notes:

* The tkscript example seems to have lost all indentation, and I think
  that the info relating to 1.6.0 can be safely lost by now.

* Tktable can be handled more easily using callbacks in R-1.7.x. I
  have an example somewhere on the laptop, I think. Interfacing to Tcl
  arrays is quite a pain as I'm sure you already found out; something
  I hope to straighten out in the future.

* You're describing the pack manager as superseded by the grid
  manager, which I think is not quite right. Both are useful in
  different contexts; some layouts are really awkward to lay out
  on a grid, so knowing the pack manager can pay off.

Re. examples and screenshots, you might be better off just taking
examples and doing your own screenshots. Things get more consistent
that way. A few examples of how things look like in the Linux
interface might be useful, though (maybe Aqua too, anyone?)