ropensci / europepmc

R Interface to Europe PMC RESTful Web Service
https://docs.ropensci.org/europepmc
27 stars 8 forks source link

remove hit_count from epmc_search results? #4

Closed cstubben closed 8 years ago

cstubben commented 8 years ago

First, thanks for all the updates. Second, I have a minor request to remove hit_count from the epmc_search results and just return a data.frame. I would add hit_count as an attribute and also create a new function like epmc_hits to get the hit_count since you often need that first before running a query to download records.

query <- 'abstract:"burkholderia pseudomallei"'
epmc_search(query, limit=1)$hit_count
1646 records found. Retrieving batch 1
[1] 1646

# ADD function to count hits  instead
epmc_hits(query)
[1] 1646

## set pageSize and limit based on hit_count 
bp <- epmc_search(query, 1000, 2000)$data
nrow(bp)
[1] 1646

# and I would just  add hit count as attribute in epmc_search 
attr(md, "hit_count") <- hit_count
md
njahn82 commented 8 years ago

Thank you for suggesting the epmc_hits function that I have implemented now. Hope, this works fine for you

cstubben commented 8 years ago

Thanks - I updated the readme on my github page to use this new function.