R/PubMatrix.R
PubMatrix.Rd`PubMatrix()` counts publications for all pairwise combinations of two term sets using the 'NCBI' Entrez 'E-utilities' API. It returns a matrix-like data frame with rows corresponding to terms in `B` and columns corresponding to terms in `A`.
PubMatrix(
file = NULL,
A = NULL,
B = NULL,
API.key = NULL,
Database = "pubmed",
daterange = NULL,
outfile = NULL,
export_format = NULL
)Optional path to a text file containing search terms. The file must contain a `#` separator line between the `A` and `B` term lists. Used only when `A` and `B` are both `NULL`.
Character vector of search terms for matrix columns.
Character vector of search terms for matrix rows.
Optional 'NCBI' API key.
Character scalar. One of `"pubmed"` or `"pmc"`.
Optional numeric vector of length 2 giving `c(start_year, end_year)`.
Optional output file stem used when `export_format` is set.
Optional export format: `"csv"` or `"ods"`.
A data frame of publication counts with rows named by `B` and columns named by `A`.
Examples and vignettes should avoid live web queries during package checks. This function performs live requests to 'NCBI' and may fail when there is no internet connectivity or when the service is unavailable.
# \donttest{
A <- c("WNT1", "WNT2")
B <- c("FZD1", "FZD2")
result <- PubMatrix(A = A, B = B, Database = "pubmed", daterange = c(2020, 2023))
print(result)
#> WNT1 WNT2
#> FZD1 10 1
#> FZD2 2 4
# }
try(PubMatrix(A = NULL, B = NULL, file = NULL))
#> Error : Either provide vectors A and B, or specify a file containing search terms.
try(PubMatrix(A = "a", B = "b", Database = "invalid_db"))
#> Error : Database must be one of 'pubmed' or 'pmc'.