ropensci / europepmc

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

search returns data.frame of lists #1

Closed cstubben closed 8 years ago

cstubben commented 9 years ago

I just installed rebi and noticed that searches return a data.frame of lists (where every "column" is a "list" instead of a numeric, character or other column type), for example x <- searcheuropmc(query = "Gabi-Kat") str(x) ##data.frame with 24 lists class(x$pubYear) # list table(x$pubYear) #can't run table on a list or plot or do much except unlist

Seems like this is created while combining multiple page results and could be fixed.

njahn82 commented 9 years ago

Thank you for your report. While trying to fix it, I thought it might be a better idea to rewrite the package, on which I mainly worked two years ago, according to the rOpenSci guidelines. In particular, I want to use httr and jsonliteinstead of RCurl and RJSONIO

To fix your problem, please use the following functions

https://gist.github.com/njahn82/39f99e3b33ce3cb30c54#file-epmc_search-r

epmc_search returns a list. The publication data has been wrapped to `tbl_df. Example

Until now, I have not been able to include them because I am running into several build issues.

I'll rewrite the other functions soon, but lately in the end of August due to summer vacations. My aim is to reapply and to have it on CRAN.

Hope, it helps.

njahn82 commented 8 years ago

Sorry for the late feedback. After I re-worked the package, epmc_search should return list of data.frame's now. Extended metadata can be fetched through epmc_details.