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
I really like the feature that let's the user submit a data.frame to the TNRS() function so that they can be easily referred in other contexts.
However, I had a 3 columns data.frame that also included some additional info on the names, then the function output a strange error.
I perfectly understand why TNRS() would only accept 2 columns data.frame and I have an easy fix for that, but maybe the error message could be clearer.
reprex:
# Works fine with a 2 columns datasetTNRS::TNRS(data.frame(ID=1, name="Helianthus annuus"))
#> ID Name_submitted Overall_score Name_matched_id Name_matched#> 1 1 Helianthus annuus 1 51089 Helianthus annuus#> Name_score Name_matched_rank Author_submitted Author_matched Author_score#> 1 1 species NA#> Canonical_author Name_matched_accepted_family Genus_submitted Genus_matched#> 1 L. Asteraceae Helianthus Helianthus#> Genus_score Specific_epithet_submitted Specific_epithet_matched#> 1 1 annuus annuus#> Specific_epithet_score Family_submitted Family_matched Family_score#> 1 1 NA#> Infraspecific_rank Infraspecific_epithet_matched Infraspecific_epithet_score#> 1 NA#> Infraspecific_rank_2 Infraspecific_epithet_2_matched#> 1 #> Infraspecific_epithet_2_score Annotations Unmatched_terms#> 1 NA #> Name_matched_url Name_matched_lsid Phonetic#> 1 http://www.tropicos.org/Name/2700851 Y#> Taxonomic_status Accepted_name Accepted_species Accepted_name_author#> 1 Accepted Helianthus annuus Helianthus annuus L.#> Accepted_name_id Accepted_name_rank Accepted_name_url#> 1 51089 species http://www.tropicos.org/Name/2700851#> Accepted_name_lsid Accepted_family Overall_score_order Highertaxa_score_order#> 1 Asteraceae 1 1#> Source Warnings#> 1 tropicos 0# Strange error message when having more than 2 columnsTNRS::TNRS(data.frame(ID=1, name="Helianthus annuus", other_name="bla"))
#> Problem with the API: HTTP Status 400#> NULL
@Rekyt An http status code from the API means a badly-formed request. @bmaitner please check the structure of the options and data elements of the JSON in the POST request. Also, I recommend returning a simple "Error: badly formed API call" when your code detects at http response of 400.
Hi
TNRS
maintainers 👋I really like the feature that let's the user submit a data.frame to the
TNRS()
function so that they can be easily referred in other contexts.However, I had a 3 columns data.frame that also included some additional info on the names, then the function output a strange error.
I perfectly understand why
TNRS()
would only accept 2 columns data.frame and I have an easy fix for that, but maybe the error message could be clearer.reprex:
Created on 2023-02-08 with reprex v2.0.2
Session info
The text was updated successfully, but these errors were encountered: