[R] R GUI using traitr to display multiple data

j verzani jverzani at gmail.com
Fri May 21 03:18:28 CEST 2010

Amitoj S. Chopra <amitojc <at> gmail.com> writes:

> Hello to everyone.
> I am constructing a GUI table using traitr with multiple buttons that
> respond to different codes. Such as I am doing titration of a protein, and I
> want the script to run and then the end to be displayed in a window. The
> window will have a button for data and graphs, where when you click on the
> data button the data will be displayed and when you click on the graph
> button the graphs will be displayed. Do you know how to set up different
> buttons with functions using the traitr GUI for R? Thanks!

There are two ways. You can use a buttonItem or to add a button to a dialog,
just use the buttons property and define a handler. Here are both in an example:

dlg <- aDialog(items=list(a = buttonItem("click me", show_label=FALSE,
                            action=function(.,...) print("clicked"))
               buttons=c("OK","Cancel","Help","Some other"),
               Someother_handler=function(.) print("some other button"))

More information about the R-help mailing list