You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In v.1.4.0, all functions with the galah_ prefix - and some underlying functions such as search_taxa - have their function name as an additional S3 class:
These S3 classes are used by galah_call to ensure arguments are piped correctly. This is different to the atlas_ group of functions, which return 'simple' tibbles with additional attributes.
We chose the attributes solution for atlas_ functions because bespoke S3 classes didn't work well with pipes, and in fact that's still true with some underlying functions, e.g. when filtering:
search_taxa("Litoria dentata", "nothing") %>%
filter(!is.na(taxon_concept_id))
No taxon matches were found for "nothing".
Error: Input must be a vector, not a <tbl_df/tbl/data.frame/ala_id> object.
Run `rlang::last_error()` to see where the error occurred.
This use case (removing unknown species via filter) instead requires removing of the additional S3 class:
search_taxa("Litoria dentata", "nothing") %>%
as_tibble() %>%
filter(!is.na(taxon_concept_id)) # works
To avoid this inconsistency, it might be desirable to stop using S3 classes within galah_ functions, and instead add a call attribute (or similar) that specifies the name of the function that created it. This would allow piping via galah_call() while not breaking piping for those who want to use it.
The text was updated successfully, but these errors were encountered:
Replacement behaviour is to add `attr(x, "call") <- "function_name"` - this has been implemented for all `galah_` functions and for taxonomic search functions (`search_taxa` and `search_identifiers`. However, `galah_call` is not yet updated, meaning that piping currently fails
… `inherits` (#133)
Last commit removed `S3` classes for `galah_` functions; this update ensures those functions are piped correctly via `galah_call` and `update_galah_call`
In v.1.4.0, all functions with the
galah_
prefix - and some underlying functions such assearch_taxa
- have their function name as an additionalS3
class:These
S3
classes are used bygalah_call
to ensure arguments are piped correctly. This is different to theatlas_
group of functions, which return 'simple'tibble
s with additionalattributes
.We chose the
attributes
solution foratlas_
functions because bespokeS3
classes didn't work well with pipes, and in fact that's still true with some underlying functions, e.g. when filtering:This use case (removing unknown species via
filter
) instead requires removing of the additionalS3
class:To avoid this inconsistency, it might be desirable to stop using
S3
classes withingalah_
functions, and instead add acall
attribute (or similar) that specifies the name of the function that created it. This would allow piping viagalah_call()
while not breaking piping for those who want to use it.The text was updated successfully, but these errors were encountered: