Code Monkey home page Code Monkey logo

Comments (4)

raymondben avatar raymondben commented on September 1, 2024

Grrrr! Well spotted! (Partially) fixed in 1.13 (see below) - the result for multiple unmatched names is now an empty data frame (the same as it is for a single unmatched name). But I think it would be more consistent for this to be a data frame with at least the column names "searchTerm","name","commonName","rank","guid" (i.e. the core set that is present in the result for a matched name).

> search_names("fljkhdlsi")
<0 x 0 matrix>

> search_names(c("fljkhdlsi","lfajldlo"))
<0 x 0 matrix>

> search_names(c("Grevillea"))
  searchTerm  name        commonName                 rank    guid                                            
1 "Grevillea" "Grevillea" "Grevillea, Spider Flower" "genus" "urn:lsid:biodiversity.org.au:apni.taxon:378603"

> search_names(c("Grevillea","k.jkasdfou"))
  searchTerm   name        commonName                 rank    guid                                            
1 "Grevillea"  "Grevillea" "Grevillea, Spider Flower" "genus" "urn:lsid:biodiversity.org.au:apni.taxon:378603"
2 "k.jkasdfou" NA          NA                         NA      NA                                              


> search_names(c("Grevillea","Macropus","fksdjhfui"))
  searchTerm  name        commonName                 rank    guid                                                                         
1 "Grevillea" "Grevillea" "Grevillea, Spider Flower" "genus" "urn:lsid:biodiversity.org.au:apni.taxon:378603"                             
2 "Macropus"  "Macropus"  NA                         "genus" "urn:lsid:biodiversity.org.au:afd.taxon:9e6a0bba-de5b-4465-8544-aa8fe3943fab"
3 "fksdjhfui" NA          NA                         NA      NA                                                                           

from ala4r.

johnbaums avatar johnbaums commented on September 1, 2024

Great - thanks. I agree, returning a data.frame with searchTerm filled and other columns NA (as per row 3 of your last example above) would be sensible.

from ala4r.

raymondben avatar raymondben commented on September 1, 2024

PS The

<0 x 0 matrix>

output comes from the print function for that class, which coerces to a matrix before printing. But I think that's unhelpfully misleading ...

from ala4r.

raymondben avatar raymondben commented on September 1, 2024

Fixed in v1.14. All-unmatched names should now return an NA-populated data.frame or list (when guids_only=TRUE) rather than an empty one. Print method also tweaked slightly.

from ala4r.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.