Changelog
Source:NEWS.md
pubmedR (development version)
Bug fixes
pmApi2df():PYis now the year of the journal issue (or of the book), not the earliest date in the record’s history, which is often one or two years before the publication (for example, the date the record was entered).pmApi2df(): titles holding an inline tag (“PM2.5”, an italic species name) wereNA, 385 of a sample of 1,500 records chosen to include them, and the tagged words were lost from abstracts and keywords. All are now read in full.pmApi2df(): an author with no fore name or initials, such as a single-name author, shifted the names of the following authors. Each author is now read as a whole, and no name ends in “NA”.pmApi2df(): collective authors are now kept in their place inAUandAF.pmApi2df(): removing an e-mail address also removed the text around it, often the country (“Pavia, Italy. m.rossi@unipv.it”). Only the address is removed now.pmApiRequest()failed, losing what it had downloaded, beyond the 9,999 records PubMed serves per search. The query is now split by date, solimitcan exceed it.records_downloadedis now the number of records actually received.API calls: a retry no longer raises a warning, a client error (HTTP 4xx) is no longer retried, and error messages no longer include a whole HTML page.
pmEnrichCitations(): an article whose citation count could not be retrieved hadTCset to 0. It now keeps its value, with a warning. Counts are requested in batches, not one article at a time.pmQueryBuild(): several values inlanguageorpub_typefailed, and they are now combined with OR. Adate_rangewithout two dates is now an error, not ignored.pmCollect():mesh_termsalone no longer fails,enrich = TRUEno longer downloads the records again, and it gains the argumentsauthor,journalandoperator.pmFetchById()ignores missing PMIDs, and reports those returning no record.Examples and tests no longer fail when NCBI is unavailable.
New functions
pmICite(): citation counts and the relative citation ratio from NIH iCite, usually much higher than the counts from PubMed.pmEnrichCitations(tc_source = "icite")uses them forTC.pmCountByYear(): the publication trend of a query, without downloading records.pmFetchByDoi(): download records by DOI, and see which DOIs are not in PubMed.
New columns
-
pmApi2df()addsPT, all the publication types of a record (DTholds only the first, usually “Journal Article” even for a review), andPMCID.
pubmedR 1.0.1
Bug fixes
-
pmEnrichCitations()no longer relies on the NCBI E-Linkpubmed_pubmed_refslink, which only resolves references for articles whose full text is deposited in PMC. The function now extracts cited references directly from the PubMed XML<ReferenceList>block, which is populated for the majority of recent articles. CR coverage on typical bibliographic queries improved from a few percent to almost full coverage on tested samples.
New functions
-
pmExtractReferences(): parse a PubMed XML payload (the result ofpmApiRequest()orpmFetchById()) and return a tidy data frame of references, one row per cited reference, with the source PMID, the raw<Citation>text, and any embedded PubMed/DOI identifiers.
Improvements
pmEnrichCitations()gains the argumentsP(reuse a previously downloaded XML payload to avoid an extraefetchround-trip),resolve_pmids(resolve cited PMIDs to WoS-style “AUTHOR YEAR, JOURNAL, V, P, DOI” citation strings via batchedefetch),only_multiple(only resolve references cited by more than one source article),include_TC(toggle the slower per-article cited-by lookup), andbatch_size(forwarded topmFetchById()).CR strings produced by
pmEnrichCitations()are now compatible with the WoS conventions parsed bybibliometrix(citations(),histNetwork(), …). References for which only a free-text<Citation>is available are kept verbatim (uppercased).pmEnrichCitations()now also writes the number of references for each article into theNRcolumn.
pubmedR 0.1.0.900
New functions
pmQueryBuild(): build PubMed search queries programmatically, with support for terms, MeSH headings, authors, journals, language, publication type, and date range filters.pmFetchById(): download PubMed records directly by a vector of PMIDs, with batch support and full compatibility withpmApi2df().pmCitedBy(): retrieve PMIDs of articles that cite a given article, using the NCBI E-Link service.pmReferences(): retrieve PMIDs of references cited by a given article, using the NCBI E-Link service.pmEnrichCitations(): batch enrich a bibliometric data frame with real citation counts (TC) and cited references (CR) from NCBI E-Link data.pmCollect(): one-step wrapper that covers the full workflow — query building, record count, download, conversion to data frame, and optional citation enrichment.
Improvements
All API calls now include error handling with automatic retry and exponential backoff (up to 3 retries).
Automatic rate limiting enforces NCBI limits: 3 requests/second without API key, 10 requests/second with API key.
API key is now auto-detected from environment variables
PUBMED_API_KEYorENTREZ_KEY, removing the need to pass it explicitly to every function.pmApiRequest()gains abatch_sizeargument (default 200) to control the number of records per API request.pmApiRequest()now returns an empty result gracefully when the query matches zero records, instead of erroring.Improved affiliation extraction in
pmApi2df(): all author affiliations are now collected (previously only the corresponding author’s affiliation was captured).Progress bars upgraded to style 3 (percentage display) across all functions.
pmApiRequest()documentation now correctly referencespmQueryBuild()(previously referenced a non-existent function).
Bug fixes
Fixed HTTP 400 error when query returns exactly one record. The
retstartparameter now correctly starts at 0 instead of 1 (GitHub issues #7 and #9, PR #13).Fixed “invalid multibyte string” error in
pmApi2df()caused by non-UTF-8 characters in PubMed XML records. Encoding is now sanitized during list-to-character conversion (GitHub issues #3 and #6).Fixed
txtProgressBarerror inpmApi2df()when converting a single record (min == maxwhenn == 1), by starting the progress bar at 0 (GitHub PR #13).
Infrastructure
Added test suite using testthat (66 tests covering utilities, query building, query counting, and data conversion).
New
README.Rmdwith live examples, function reference table, workflow diagram, and integration guide for bibliometrix/biblioshiny.Internal utility functions (
list2char,get_api_key,api_throttle,api_call_with_retry) extracted intoR/utils.R.