PubMed Pairwise Co-Occurrence Matrix Construction and Visualization
Overview
Queries the 'NCBI' (National Center for Biotechnology Information) Entrez 'E-utilities' API to count pairwise co-occurrences between two sets of terms in 'PubMed' or 'PubMed Central'. It returns a matrix-like data frame of publication counts and can export hyperlink-enabled results in CSV or ODS format. The package also provides heatmap helpers for exploratory visualization of overlap patterns. Based on the method described in Becker et al. (2003) "PubMatrix: a tool for multiplex literature mining" doi:10.1186/1471-2105-4-61.
Breaking changes
plot_pubmatrix_heatmap()andpubmatrix_heatmap()now plot raw co-occurrence counts by default, and take a newvaluesargument to choose otherwise. Earlier versions always plotted a percentage the docs calledintersection / union * 100, but the totals in that formula were row and column sums of whatever matrix you passed in, not the publication counts for each term on its own. Adding an unrelated term changed the number shown in every other cell. The old calculation is still there asvalues = "relative", now documented with that caveat.values = "row_pct"divides each count by its row total.
Bug fixes
PubMatrix()no longer drops columns whenArepeats a term, or rows whenBdoes. Duplicates now raise an error, and the result matrix is filled positionally instead of by name.- Character matrices passed to the heatmap helpers keep their row names. A single-row matrix no longer comes back transposed into a single column.
- Term file parsing handles blank lines, and a
#separator on the first or last line now gives an error that names the file instead of complaining about missing terms. - A matrix where every value is the same now warns and draws a single-colour heatmap. It used to stop with an error.
- Heatmap validation errors no longer print internal call context.
Other improvements
- Requests are spaced out to stay under the NCBI rate limits: 3 per second without an API key, 10 with one. Set
PubMatrixR.min_intervalto override. - Failed queries back off exponentially between retries, and the default number of attempts (
PubMatrixR.n_tries) is now 3. Both options are documented. - Queries drop
usehistory=yand setretmax=0, so responses no longer carry PMIDs the package never looks at.
Show all changes in 1.0.1Hide the rest of the changes in 1.0.1
- Added coverage reporting through covr and Codecov, and set
Config/testthat/edition: 3. - The test suite went from 29 assertions to 73.
From NEWS.md in the release
Install
Health
- OK13 OK2026-08-05
- NOTE12 OK, 1 NOTE2026-08-01
- OK3 OK2026-03-13
Documentation
- Help pages
- 4 (1 internal)includes a package overview page
- Examples that run
- 100%3 run in a plain check
- Exported functions with examples
- 100%
- Documented parameters
- 100%
- Return-value docs
- 100%
- Help pages citing references
- 0%
Downloads
Repository
- PRs merged (all time)
- 100%
- Median days to close, 50 most recently updated closed issues
- not measured
- Median days to close, 50 most recently updated closed PRs
- 0
Stars over time
Releases over time
Commits over time
5 development-tooling and community-health practices detected across 4 families in the upstream repository
Checks run against github.com/toledoem/pubmatrixr-v2 on 2026-10-18.
The R CMD check workflow runs on Linux, macOS and Windows, and on R-devel
Dependencies
Installing PubMatrixR adds 29 packages (14 with compiled code, 20 MB of source tarballs). Heaviest: stringi 11 MB, farver 1.2 MB, viridisLite 1.2 MB.
Code & Tests
People & History
Pick two releases to compare their code metrics.
- RR 4.6.0 released · 2026-04-24
- 1.0.1Latest
- 1.0.02026-03-12
- RR 4.5.0 released · 2025-04-11
Package metadata
- First published
- 2026-03-12
- Total releases
- 2 / 1 yrs
- License
- MIT + file LICENSE OSI
- Minimum R
- ≥ 4.1.0
- Download size
- 1.7 MB
Cite
Cite this package
Run in R for the authors' entry:
citation("PubMatrixR")The package provides a citation file, so citation() returns the authors' own entry.
It points to 10.1186/1471-2105-4-61.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-21, which the citation names so these numbers can be found later. More on citing and the projects behind them.