Debian Codegraph @

R/pkgDesc.R

raw
1 ##' A slightly more convenient version of packageDescription()
2 ##' 1. returns named character vector; no other attributes
3 pkgDesc <- function (pkg, lib.loc = NULL, fields = NULL, onlyLT = 99, ...) {
4 pd <- packageDescription(pkg, lib.loc=lib.loc, fields=fields, drop=FALSE, ...)
5 if(is.numeric(onlyLT) && onlyLT > 0 && any(tL <- vapply(pd, nchar, -99L) >= onlyLT))
6 pd[tL] <- NULL
7 file <- attr(pd, "file")
8 struct(class = "Dlist", c(unlist(pd), c(file=file)))
9 }
10
11 ##' useful: e.g. as sapply( pkgs, pkgBuilt)
12 pkgBuilt <- function(pkg, lib.loc = NULL, ...) pkgDesc(pkg, lib.loc=lib.loc, fields = "Built", ...)