I am building a custom GUI in R for work, and I need to have a part that can select a subset of a dataframe based on variable values (i.e. select all females that are above 50 etc.). I am building the GUI with gwidgets, but I am stuck with regards to how this filter can be implemented. Specifically how to create a widget that allows the user to select one or more filters and then return the filtered data frame.
Here is a small sample from the data I am working with:
structure(list(kunde = c(3, 3, 3, 3, 3, 3, 3, 1, 3, 3),
bank = c(7,98, 3, 3, 98, 2, 2, 1, 7, 2)),
.Names = c("kunde", "bank"), row.names = c(NA, 10L), class = "data.frame")
Any help is greatly appreciated!!
There are some examples of similar things in the
ProgGUIinRpackage. Here is one of them:For your purpose, you might want to use
gcheckboxgrouporgcomboboxto select factor levels or a level and filter by that. The key is thevisible<-method of thegtableobject is used to filter the displayed items.If you are game, you can try the
gfilterwidget ingWidgets2which as of know is just on my github site (useinstall_packages("gWidgets2", "jverzani")from devtools, alsogWidgets2RGtk2). This may be just what you are trying to do.