europepmc
europepmc copied to clipboard
Error if no results in epmc_search?
I sometimes run epmc_search in a loop, and if no results are found, it exits with an error. Right now I'm checking error messages, but it might be better if "No results found" returns a message and empty table instead?
if (hits == 0){
message("There are no results matching your query")
md <- tibble()
}else{
...
}
attr(md, "hit_count") <- hits
return(md)
Agreed, it is more sensible to return NULL
and a message when no results are found. Will implement it.
Great, thanks. At least with an empty table you can still add the hit_count attribute, but NULL works too.
@cstubben is now on master branch, hope, it works for you!