parse_installed {pkgcache}R Documentation

List metadata of installed packages

Description

This function is similar to utils::installed.packages(). See the differences below.

Usage

parse_installed(
  library = .libPaths(),
  priority = NULL,
  lowercase = FALSE,
  reencode = TRUE,
  packages = NULL
)

Arguments

library

Character vector of library paths.

priority

If not NULL then it may be a "base" "recommended" NA or a vector of these to select base packages, recommended packages or other packages. (These are the official, CRAN supported package priorities, but you may introduce others in non-CRAN packages.)

lowercase

Whether to convert keys in DESCRIPTION to lowercase.

reencode

Whether to re-encode strings in UTF-8, from the encodings specified in the DESCRIPTION files. Re-encoding is somewhat costly, and sometimes it is not important (e.g. when you only want to extract the dependencies of the installed packages).

packages

If not NULL, then it must be a character vector, and only these packages will be listed.

Details

Differences with utils::installed.packages():

Encodings

parse_installed() always returns its result in UTF-8 encoding. It uses the Encoding fields in the DESCRIPTION files to learn their encodings. parse_installed() does not check that an UTF-8 file has a valid encoding. If it fails to convert a string to UTF-8 from another declared encoding, then it leaves it as "bytes" encoded, without a warning.

Errors

pkgcache silently ignores files and directories inside the library directory.

The result also omits broken package installations. These include

These errors are reported via a condition with class pkgcache_broken_install. The condition has an errors entry, which is a data frame with columns

If you intend to handle broken package installation, you need to catch this condition with withCallingHandlers().


[Package pkgcache version 2.2.2 Index]