packageSum: Add Info from Installed Packages to PackageSummary

View source: R/packageSum.R

packageSumR Documentation

Add Info from Installed Packages to PackageSummary

Description

Obtain a summary by package of a findFn object give it class packageSum.

This is a simple function, first calling PackageSum2, than assigning class packagesum to it.

Usage

packageSum(x,
    fields=c("Title", "Version", "Author",
      "Maintainer", "Packaged", 'helpPages',
      'vignette', 'URL'), 
    lib.loc=NULL, ...)
## S3 method for class 'findFn'
packageSum(x,
    fields=c("Title", "Version", "Author",
      "Maintainer", "Packaged", 'helpPages',
      'vignette', 'URL'), 
    lib.loc=NULL, ...)
## S3 method for class 'data.frame'
packageSum(x,
    fields=c("Title", "Version", "Author",
      "Maintainer", "Packaged", 'helpPages',
      'vignette', 'URL'), 
    lib.loc=NULL, ...)
## S3 method for class 'list'
packageSum(x,
    fields=c("Title", "Version", "Author",
      "Maintainer", "Packaged", 'helpPages',
      'vignette', 'URL'), 
    lib.loc=NULL, ...)

Arguments

x

a data.frame with columns Package and Score.

fields

character vector of names of columns to add to x. The function first looks in the components of packageDescription(x$Package[i]). vignette is obtained via the function of that name.

Component Packaged receives special treatment. If present, only the portion preceding ';' will be retained. This seems to be a time stamp automatically generated by something like R CMD build. It is absent for packages automatically loaded when R is started. In such cases, the third component of strsplit(packageDescription( x$Package[i])$Built, ..., ';') will be stored as Packaged. This seems to be a time stamp automatically generated by something like R CMD INSTALL --build.

lib.loc

an optional lib.loc argument passed to packageDescription.

...

additional arguments (currently unused)

Details

With an object of class findFn, call PackageSum2, then make it class packageSum.

If less than half of the package reference are installed, it prints a note suggesting the user call installPackages, because much of the information is obtained from the packages' DESCRIPTION file.

Value

a data.frame of class c('packageSum', 'data.frame').

Author(s)

Spencer Graves

See Also

findFn PackageSum2 PackageSummary installPackages

Examples

##
## data.frame method
##
tstdf <- data.frame(Package=c('grid', 'base'), 
            stringsAsFactors=FALSE)
tst2 <- packageSum(tstdf)

##
## list method
##
tstList <- list(PackageSummary=tstdf)


all.equal(tst2, packageSum(tstList))

##
## findFn method
##
tst.findFn <- data.frame(
    Package=c('grid', 'base')[c(1,1,2)], 
    Score=2:4, Date=LETTERS[1:3], stringsAsFactors=FALSE)
attr(tst.findFn, 'PackageSummary') <- 
    PackageSummary(tst.findFn)
class(tst.findFn) <- c('findFn', 'data.frame')
tst2. <- packageSum(tst.findFn)


all.equal(tst2, tst2.[names(tst2)])

##
## spline example 
##
splineHelp <- findFn("spline", maxPages = 2)
splinePkgs <- packageSum(splineHelp)

sos documentation built on June 30, 2024, 1:06 a.m.