A widget for filtering a data frame
This widget provides a simple means to subset, or filter, a data frame.
generic for toolkit dispatch
The svalue
method for a filter object returns a logical
containing which rows are selected. There is no assignment method.
The extraction method returns the child items of the filter, like a container object.
Default
gfilter(DF, allow.edit = TRUE, initial.vars = NULL, handler = NULL, action = NULL, container = NULL, ..., toolkit = guiToolkit()) .gfilter(toolkit, DF, allow.edit = TRUE, initial.vars = NULL, handler = NULL, action = NULL, container = NULL, ...) ## S3 method for class 'GFilter' svalue(obj, index = NULL, drop = NULL, ...) ## S3 method for class 'GFilter' x[i, j, ..., drop = TRUE] ## Default S3 method: .gfilter(toolkit = guiToolkit(), DF, allow.edit = TRUE, initial.vars = NULL, handler = NULL, action = NULL, container = NULL, ...)
DF |
a data frame or |
allow.edit |
logical. If |
initial.vars |
When given, this is a data frame whose first
column specifies the variables within |
handler |
A handler assigned to the default change
signal. Handlers are called when some event triggers a widget to
emit a signal. For each widget some default signal is assumed, and
handlers may be assigned to that through Handlers may also be added via |
action |
User supplied data passed to the handler when it is called |
container |
A parent container. When a widget is created it can be incorporated into the widget heirarchy by passing in a parent container at construction time. (For some toolkits this is not optional, e.g. gWidgets2tcltk or gWidgets2WWW2.) |
... |
dots argument |
toolkit |
Each widget constructor is passed in the toolkit it
will use. This is typically done using the default, which will
lookup the toolkit through |
obj |
object of method call |
index |
NULL or logical. If |
drop |
NULL or logical. If widget supports it, drop will work as it does in a data frame or perhaps someother means. |
x |
the |
i |
passed to |
j |
passed to |
returns GFilter
object
## Not run: DF <- mtcars[, c("mpg", "cyl", "hp", "am", "wt")] w <- gwindow("Example of gfilter", visible=FALSE) pg <- ggroup(container=w) df <- gtable(DF, container=pg) a <- gfilter(df, initial.vars=data.frame(names(DF), names(DF), c("single", "multiple", "range", "single", "range"), stringsAsFactors=FALSE), allow.edit=TRUE, container=pg, handler=function(h,...) { visible(df) <- h$obj$get_value() } ) size(w) <- c(600, 600) visible(w) <- TRUE ## End(Not run)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.