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

Support piping in galah functions #120

Closed
mjwestgate opened this issue Jan 5, 2022 · 1 comment
Closed

Support piping in galah functions #120

mjwestgate opened this issue Jan 5, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@mjwestgate
Copy link
Collaborator

Currently, it is necessary to specify arguments within a function to narrow a query, as follows:

atlas_counts(taxa = search_taxa("Litoria"))

A more modern approach is to use piping, e.g.:

galah_call() |>
  search_taxa("Litoria") |>
  atlas_counts()
@mjwestgate mjwestgate added the enhancement New feature or request label Jan 5, 2022
mjwestgate added a commit that referenced this issue Jan 5, 2022
…120)

These functions now detect, and if detected update, a `data_request` object, which has a dedicated S3 method in both `atlas_counts` and `atlas_occurrences` (other functions to follow)
@mjwestgate
Copy link
Collaborator Author

Bug fix for atlas counts b914ab3

mjwestgate added a commit that referenced this issue Jan 5, 2022
Note this function no longer calls `galah_select`
mjwestgate added a commit that referenced this issue Jan 6, 2022
This required an update to `galah_call` to support the `down_to` argument. Also updated `galah_call` to use `abort` and `glue` rather than `stop` (as per #117)
mjwestgate added a commit that referenced this issue Jan 6, 2022
Also update `data_request` S3 methods to use `formals` for argument detection in `atlas_occurrences` & `atlas_counts`
mjwestgate added a commit that referenced this issue Jan 6, 2022
previously `search_taxa` would only work if it was the first function in a chain, and couldn't handle multiple instances of `search_taxa` within a chain. This is fixed by borrowing the approach from the other `galah_` functions, which use `quosures`
mjwestgate added a commit that referenced this issue Jan 6, 2022
…ah_geolocate` (#120)

Previously, these functions would only work if they were placed first in the pipe. This approach is also more consistent with other `galah_` functions.

Also some functions between files moved for improved clarity
mjwestgate added a commit that referenced this issue Jan 6, 2022
Also:
- consistent S3 methods for class `data_request` across all `atlas_` functions
- ensure non-core arguments are retained by `galah_call_update`
- force `galah_geolocate` to test for strings when `sf` objects are not passed
- fix bug in `atlas_counts` where geolocation data was not passed to the ALA when 'type = "species"`
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
None yet
Development

No branches or pull requests

2 participants