Description Usage Arguments Value Examples
This widget provides a simple means to subset, or filter, a data frame.
The svalue
method for a filter object returns a logical
containing which rows are selected. There is no assignment method.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | 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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ## 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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.