Closed landroni closed 10 years ago
Oh, by default dffilter() would load this preset with head(..., 1000), as rstudio::View() does. I think it's useful, and if the user wants something else, they can remove the preset or change the subset value/function.
I don't see why you couldn't do this. It might be better to parse some input for the lines, e,g,:
1:10, 11, 15:22
Since you are parsing, you could even have an end (julia like, with 1:end) instead of 1:length(x) (but x is not really a variable so that would be confusing).
I now came up with a working prototype of the feature. Several implementation issues persist:
sl <- gslider(from=1, to=1645, value=1001, by=10, cont=g, expand=TRUE, fill="both")
this works fine, but it refuses to work in gfilter()? Any ideas why? by=
a vector with all the steps that the slider should have? For example, for a dataframe with 103 rows, I'd like to have as steps: 10, 20, ..., 90, 100, 103. As it is I'm not sure that this can be done. PresetItem$new(x, name=name, parent=.self, includeNA=FALSE)
, but this doesn't seem the right way to go about it. All the issues noted above have been addressed one way or another in the updated PR. Now the feature is pretty much complete and ready for inclusion.
This is sitting rather high on my TODO list ( https://github.com/landroni/gWidgets2-filter/blob/master/TODO ), but I have trouble deciding how best to integrate it into gfilter().
I was thinking of providing a "preset" filtering item that could be 'Add'ed as other row filters, but instead of focusing on any given variable, it would present a generic interface for head(), tail() and car::some(). The funs are extremely useful when inspecting a data frame, for example when checking that some operation on a DF went as expected.
This thingy could take the form of a gfilterpreset() fun modeled on gfilter(), that when called via 'Add preset' would add a widget that has three radio choices c('head', 'tail', 'some'), with 'some' being disabled if package 'car' is not available and below either a scrollbar with 1:nrow(df) or a spinner with same range. I think it should be possible to checkbox negative for the range, as head and tail allow, but not some.
Is this feasible?