Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pat_filter() function #26

Closed
jonathancallahan opened this issue Mar 29, 2019 · 1 comment
Closed

pat_filter() function #26

jonathancallahan opened this issue Mar 29, 2019 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@jonathancallahan
Copy link
Member

jonathancallahan commented Mar 29, 2019

Because we have stuffed the actual tibbles associated with a pat object inside of pat$meta and pat$data we cannot use dplyr filtering on our pat object.

So we need a pat_filter() function which applies the incoming filtering expression to pat$data and returns the modified pat object.

Using pat_filter() should feel just like working with dplyr::filter().

See PWFSLSmoke::monitor_subsetBy() for example code for how to do this.

We already have a pat_filterDate() function that simplifies things for the most common usage and we should provide pat_filterData() that is more general just to be complete.

For extra-completeness, we should have a pat_filter() function that just wraps pat_filterData().

That seems like a good API for end users:

  • ~_filter() -- wrapper for ~_filterData() for those expecting dplyr::filter()
  • ~_filterDate() -- convenience function; just specify user friendly startdate and enddate
  • ~_filterData() -- explicit; does just what it says
@jonathancallahan jonathancallahan added the enhancement New feature or request label Mar 29, 2019
@jonathancallahan jonathancallahan added this to To do in AirSensor 0.2 via automation Mar 29, 2019
@hmrtn hmrtn moved this from To do to In progress in AirSensor 0.2 Apr 9, 2019
@hmrtn
Copy link
Contributor

hmrtn commented Apr 9, 2019

This can be done using dplyr - so it acts just like dplyr! Keep in mind, returning a pat object does not play well with pipeing as dplyr expects a data.frame. i.e. pat %>% pat_filterData(something>else) %>% group_by(etc) will throw an error.

@hmrtn hmrtn moved this from In progress to Done in AirSensor 0.2 Apr 9, 2019
@hmrtn hmrtn moved this from Done to In progress in AirSensor 0.2 Apr 11, 2019
@hmrtn hmrtn moved this from In progress to Done in AirSensor 0.2 Apr 11, 2019
@hmrtn hmrtn closed this as completed Apr 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
No open projects
AirSensor 0.2
  
Done
Development

No branches or pull requests

2 participants