[R-gui] file load dialog with traitr

christiaan pauw cjpauw at gmail.com
Mon Nov 28 21:35:47 CET 2011


Hi Everybody

I have learned about the traitr package recently following a
suggestion from this list. I think this package has massive potential.
I am working through the documentation to try to build up a sufficient
understanding to enable me to build a gui environment for my
functions.

One of the common tasks is loading a file. After reading the vignette
, I attempted to write a dialog to load a .Rda file (below) since this
is a very common task. It doesn't work. Can someone please help me
spot the mistake?

Thanks in advance
Christiaan

# Simple Load GUI (but it doesn't work)
require(traitr)

dlg <- aDialog(items=list(
                 file=fileItem(""),
                 assign.to=stringItem("", label="Assign to:")
                  ),
               title="Load a .Rda file",
               help_string="Select a file, then load",               )

dlg$OK_handler <- function(.) {
  out <- .$do_call("load",.$get_file())
  assign.to <- .$get_assign.to()
  assign(assign.to, out, envir=.GlobalEnv)
}
dlg$make_gui()

(R:3012): Gtk-WARNING **: Unable to find default local directory monitor type

(R:3012): Gtk-WARNING **: Unable to find default local directory monitor type
Error in file$to_R : object of type 'closure' is not subsettable

-- 
Christiaan Pauw
Nova Institute
www.nova.org.za



More information about the R-SIG-GUI mailing list