Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error if no results in epmc_search? #20

Open
cstubben opened this issue Apr 26, 2017 · 3 comments
Open

Error if no results in epmc_search? #20

cstubben opened this issue Apr 26, 2017 · 3 comments

Comments

@cstubben
Copy link

cstubben commented Apr 26, 2017

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)
@njahn82
Copy link
Member

njahn82 commented Apr 26, 2017

Agreed, it is more sensible to return NULL and a message when no results are found. Will implement it.

@cstubben
Copy link
Author

Great, thanks. At least with an empty table you can still add the hit_count attribute, but NULL works too.

njahn82 added a commit that referenced this issue May 18, 2017
returning NULL instead of error when nothing was found #20
@njahn82
Copy link
Member

njahn82 commented May 18, 2017

@cstubben is now on master branch, hope, it works for you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants