matildabrown / rWCVP

Generating Summaries, Reports and Plots from the World Checklist of Vascular Plants
https://matildabrown.github.io/rWCVP/
GNU General Public License v3.0
19 stars 0 forks source link

Brickellia brandegei B.L.Rob. throws error #51

Closed pgomba closed 1 year ago

pgomba commented 1 year ago

Hi, Unsure if this is just my problem or is expected for wcvp_match_names() to handle this cases too. I have a list with some names throwing errors when using wcvp_match_names().

For example:

species_list<-data.frame(taxon_name="Brickellia brandegei",taxon_author="B.L.Rob.")  

matches <- species_list%>%
       wcvp_match_names(name_col="taxon_name",
                     author_col ="taxon_author", 
                     fuzzy=TRUE,
                     progress_bar=TRUE)

I was expecting Brickellia brandegei B.L.Rob. to be matched/corrrected with Brickellia brandegeei B.L.Rob, but instead I get an error. I will edit this post and add some other problematic names here here:

Capture

matildabrown commented 1 year ago

Hi @pgomba ,

Does this work for you? I tacked it onto the end of the example dataset and got the expected match - just trying to work out where the error is coming from.

test <- data.frame(scientificName = "Brickellia brandegei",
                   authority = "B.L.Rob.")

test <- bind_rows(redlist_example, test)

test_result <- wcvp_match_names(test, name_col="scientificName",
                                    author_col ="authority", 
                                    fuzzy=TRUE)
View(test_result)
pgomba commented 1 year ago

Yes, it does work.

This alone also works too:

test <- data.frame(scientificName = "Brickellia brandegei",
                   authority = "B.L.Rob.")

test_result <- wcvp_match_names(test, name_col="scientificName",
                                    author_col ="authority", 
                                    fuzzy=TRUE)

but this doesn't

species_list<-data.frame(taxon_name="Brickellia brandegei",
                                      taxon_author="B.L.Rob.")

matches <-  wcvp_match_names(species_list, name_col="taxon_name",
                             author_col ="taxon_author", 
                             fuzzy=TRUE)

Hopefully I'm not missing something basic and obvious here

matildabrown commented 1 year ago

Ah! The column name 'taxon_name' is in the WCVP database (we rename in the returned object but not during matching) - I'll add an error message that warns you if you have taboo names in the input. Thanks for picking this up!

matildabrown commented 1 year ago

Fixed in c0ef5d7