Closed johnbaums closed 9 years ago
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
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.
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 ...
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.
If an unrecognised taxon name is passed to
search_names
, it returnsBut if a vector of unrecognised names (i.e. none of them are recognised) is passed, it returns
e.g.
and
but