Selecting a row in a dataframe in RGTK2
Frage
I want to perform something like the one below:
- display a dataframe in RGTK2 window, with scrollbar on the right
- user can select the specific row in the dataframe by clicking on it, and I can "get" which row the user has actually clicked
I wonder if this can be done using RGtk2. Thanks.
Lösung
Yes, of course. Have a look at: https://github.com/jverzani/gWidgets2RGtk2/blob/master/R/gtable.R . You can pull out most of the first request in the initialize
method and the second in the set_selected
and get_selected
methods. The task is made much easier (and faster!) by Michael Lawrence's rGtkDataFrame
constructor to turn data frames into models that RGtk2's views can use quite easier.
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow