cran / easyPubMed

:exclamation: This is a read-only mirror of the CRAN R package repository. easyPubMed — Search and Retrieve Scientific Publication Records from PubMed. Homepage: https://www.data-pulse.com/dev_site/easypubmed/
8 stars 4 forks source link

error when converting to dataframe #1

Open rpietro opened 6 years ago

rpietro commented 6 years ago

Hi, I was trying to test the package with the following script, but it gives me an error when trying to convert the xml to a dataframe:

pubmedquery <- '((japan [Affiliation]) AND "Musculoskeletal Diseases"[Mesh]) AND ("2017/01/01"[Date - Entrez] : "3000"[Date - Entrez]))' pubmedxml <- easyPubMed::batch_pubmed_download(pubmed_query_string = pubmedquery, dest_file_prefix = "apex1_sample") pubmed_df <- easyPubMed::table_articles_byAuth(pubmed_data = pubmedxml[1], included_authors = "first", max_chars = 0)

Error message is:

Error in rbind(deparse.level, ...) :
numbers of columns of arguments do not match

I tried to export the xml to run a linter looking for syntax errors, but it looks like the data object is a string. Anyway, just wondering if you had any suggestions. thanks

rpietro commented 6 years ago

Just as an additional comment: I downloaded the XML for this search directly from PubMed and validated it through a linter without a problem. So, it looks like the problem is not the XML being corrupted, I guess

gaborcsardi commented 6 years ago

Hi, this is a read-only mirror of CRAN. Please contact the original package authors. See the DESCRIPTION file. THanks!

nthun commented 6 years ago

@rpietro Hi, I had the same problem. As a hotfix, if you change the rbind to dplyr::bind_rows, in the table_articles_byAuth.R it will work.

Do this: Change this line: papers.authors.df <- do.call(rbind, papers.authors.list) to this: papers.authors.df <- dplyr::bind_rows(papers.authors.list)

I'd do a PR, but as @gaborcsardi pointed out, this is not the official package repo. Also, I don't know if the author would like to have dplyr dependency.