[R] Using tcltk or other graphical widgets to view zoo time series objects

j verzani jverzani at gmail.com
Fri Jan 29 03:18:43 CET 2010


Research <risk2009 <at> ath.forthnet.gr> writes:

> 
> Dear all,
> 
> I am looking at the R-help entry below:
> 
> http://finzi.psych.upenn.edu/R/Rhelp02/archive/26640.html
> 
> I have a more complicatedt problem. I have a zoo time series frame with 
> 100+ sequences.
> 
> I want to cycle through them back and forth and compare them to the 1st 
> column at any time.
> 

The playwith solution is shorter but this GUI mockup using gWidgets might be
more flexible:

library(gWidgets)

make_plot <- function(i, ...) {
  ## your plot goes here
  cat(i)
  plot(1, i)
}
do_something <- function(i,..) {
  cat("clicked on", i, "\n")
}

w <- gwindow("Plot example")
g <- ggroup(cont=w, horizontal=FALSE)
i <- gslider(from=2, to=100, by=1, cont=g, handler=function(h,...) {
  make_plot(svalue(h$obj))
})
b <- gbutton("do something", cont=g, handler=function(h,...) {
  do_something(svalue(i))
})


That will work with tcltk and RGtk2. If you have RGtk2 installed, then you might
also like this GUI template using traitr:


library(gWidgets)
options(guiToolkit="RGtk2")
require(traitr)

dlg <- aDialog(items=list(
                 i=rangeItem(value=2, from=2, to=100, by=1),
                 g=graphicDeviceItem()
                 ),
               buttons="Details...",
               property_i_value_changed=function(., value, old_value) {
                 make_plot(value)
               },
               Details_handler = function(.) {
                 do_something(.$to_R()$i)
               })
dlg$make_gui()
                 
                 




> I need also a button to click when I need the viewed-selected sequence 
> (that is being compared to the 1st column one) to be manipulated
> (by some algorithm or be saved individually etc. etc.)...
> 
> I am trying to modify the code at the above link but somehow I can not 
> make it to work with zoo time series objects.
> 
> Any help would be greatly appreciated.
> 
> Thanks in advance,
> Costas
> 
> __________ Information from ESET Smart Security, version of virus signature
database 4813 (20100128) __________
> 
> The message was checked by ESET Smart Security.
> 
> http://www.eset.com
> 
>



More information about the R-help mailing list