This code is adapted from installed.versions, but uses an Rcpp alternative to readLines for speed. It will be anywhere from 2x to 10x faster than the installed.versions function. This is also many times faster than utils::installed.packages, especially if only a subset of "all" packages in libPath are desired (1000x ? for the 1 package case).

installedVersions(packages, libPath)



Character vector of packages to determine which version is installed in the libPath.


The library path where all packages should be installed, and looked for to load (i.e., call library)


installedVersions("reproducible", .libPaths()[1])
#> [1] ""