Skip to contents

This function checks the installed and latest available versions of R packages across CRAN, Bioconductor, and GitHub. It supports case-insensitive matching and smart console previews.

Usage

pkg_version(pkg, preview = TRUE)

Arguments

pkg

Character vector of package names.

preview

Logical. If TRUE, print the result to console.

Value

A data.frame with columns: package, version (installed), latest (available), and source.

Examples

pkg_version(c("ggplot2", "limma", "MRPRESSO", "nonexistentpackage123"))
#> 
#> ── Fetching installed R packages... ────────────────────────────────────────────
#> 
#> ── Fetching CRAN package database... ───────────────────────────────────────────
#> 
#> ── Fetching Bioconductor package database... ───────────────────────────────────
#> 'getOption("repos")' replaces Bioconductor standard repositories, see
#> 'help("repositories", package = "BiocManager")' for details.
#> Replacement repositories:
#>     CRAN: https://mirrors.tuna.tsinghua.edu.cn/CRAN/
#> 
#> ── Checking package: ggplot2 ──
#> 
#>  Found on CRAN: 3.5.2
#> 
#> ── Checking package: limma ──
#> 
#>  Found on Bioconductor: 3.64.0
#> 
#> ── Checking package: MRPRESSO ──
#> 
#>  Found on GitHub: GitHub (rondolab/MR-PRESSO@HEAD) (SHA: 3e3c92d)
#> 
#> ── Checking package: nonexistentpackage123 ──
#> 
#> ! Not found in CRAN, Bioconductor, or GitHub.
#>                 package version  latest                           source
#> 1               ggplot2   3.5.2   3.5.2                             CRAN
#> 2                 limma  3.64.0  3.64.0                     Bioconductor
#> 3              MRPRESSO     1.0 3e3c92d GitHub (rondolab/MR-PRESSO@HEAD)
#> 4 nonexistentpackage123    <NA>    <NA>                        Not Found