Re: [R] R user interface

From: jverzani <jverzani_at_gmail.com>
Date: Thu, 17 Jun 2010 16:57:59 +0000 (UTC)

Shubha Vishwanath Karanth <shubhak <at> ambaresearch.com> writes:

>
> Hi R,
>
> I have a an excel file with a lot of data. I need to create an user
> interface in R, which has one single screen. It needs to contain a right
> pane containing the click buttons for different countries (say). If the
> user clicks a country, then a chart needs to be created for that
> country, taking the data from Excel. Is this possible and which package
> helps me in doing this? Many thanks in advance.
>
> Thanks and Regards,
>

If you don't mind installing the GTK libraries, then the traitr package can be used here without too much difficulty. Here is what you can do for your request (a stripped down version of a demo in the vignette)

## sample data, replace me

d <- data.frame(country=c("US","US","Canada","Mexico"),
                x = rnorm(1:4),
                y = rnorm(1:4))

library(traitr)

library(gWidgets) ## also gWidgetsRGtk2, cairoDevice options(guiToolkit="RGtk2")

countries <- unique(d$country)

dlg <- aDialog(items=list(

                 output=graphicDeviceItem(),
                 countryFilter=choiceItem(value=countries, values=countries,
                               multiple=TRUE, show_label=FALSE)
                 ),
               help_string="Use filter to narrow",
               ## this is called when the countryFilter checkbox is clicked
               property_countryFilter_value_changed=function(.,...)
                 .$make_plot(),
               ## this draws the plot
               make_plot=function(.) {
                 countries <- .$get_countryFilter()
                 ## adapt this:
                 plot(y ~ x, data=d, subset=country %in% countries)
               })
view <- aPanedGroup(aContainer("output"),
                    aFrame(label="Filter by:",
                           aFrame("countryFilter", label="Country")),
                    horizontal=TRUE
                    )

dlg$make_gui(gui_layout=view)
dlg$make_plot()

> Shubha Karanth
>
> This e-mail may contain confidential and/or privileged i...{{dropped:13}}
>
>



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Thu 17 Jun 2010 - 16:59:59 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 17 Jun 2010 - 17:30:32 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive