Version of packageDescription() as Simple Vector
a simple “version”, or wrapper for
packageDescription()
, returning a named character vector,
including "file"
, and still has a useful print()
method.
pkgDesc (pkg, lib.loc = NULL, fields = NULL, ...) pkgBuilt(pkg, lib.loc = NULL, ...)
pkg |
a |
lib.loc |
library location to find the package in; the default
|
fields |
a character vector (or |
... |
further optional arguments passed to |
a named character
vector, with names
, the
fields, identical to the names of the list
returned
by packageDescription
, plus its "file"
attribute.
Additionally the resulting vector is of class "Dlist"
which
activates a useful print()
method.
The file
is always returned; not the least that the author
wants to see it quite often as his .libPaths()
is
non-trivial and typically longer than 4 entries.
Martin Maechler, Jan. 2021
str(pd <- pkgDesc("sfsmisc")) pd[c("Date","Packaged", "Built","file")] pkgBuilt("sfsmisc") ## Show "Built" (and "file") for all packages whose namespaces are loaded: lNs <- loadedNamespaces() mlNs <- sapply(lNs, pkgBuilt) t(mlNs) # typically prints nicely pkgs <- c("grid", "lattice", "MASS", "Matrix", "nlme", "lme4", "sfsmisc") pkgs <- c("foobar", "barbar", pkgs, "kitty") # + names that typically don't exist pkgsOk <- basename(find.package(pkgs, quiet=TRUE)) mpkg <- sapply(pkgsOk, pkgBuilt) stopifnot(is.matrix(mpkg), nrow(mpkg) == 2) mpkg["Built",]
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.