| PackageSum2 {sos} | R Documentation |
Add information on installed packages to the PackageSummary of
a findFn object.
PackageSum2(x,
fields=c("Title", "Version", "Author", "Maintainer", "Packaged",
'helpPages', 'vignette'), lib.loc=NULL, ...)
## S3 method for class 'findFn':
PackageSum2(x,
fields=c("Title", "Version", "Author", "Maintainer", "Packaged",
'helpPages', 'vignette'), lib.loc=NULL, ...)
## S3 method for class 'data.frame':
PackageSum2(x,
fields=c("Title", "Version", "Author", "Maintainer", "Packaged",
'helpPages', 'vignette'), lib.loc=NULL, ...)
## S3 method for class 'list':
PackageSum2(x,
fields=c("Title", "Version", "Author", "Maintainer", "Packaged",
'helpPages', 'vignette'), lib.loc=NULL, ...)
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) |
With an object of class findFn, extract the
PackageSummary attribute and pass it to the data.frame
method.
With an object of class list, extract the PackageSummary
component and pass it to the data.frame method.
For a data.frame that is not an findFn object, add
other columns from attributes of packageDescription for
installed packages named in the column Package. Also, for any
packages that are installed, replace the Date with the
Packaged date. The Date in Baron's RSiteSearch
database is the date of acquisition, which will typically be more
recent than the Packaged date provided the locally installed
package has the same version as that in Baron's database. To get the
best information from PackageSum2, it is wise to first run both
installPackages to ensure that the packages of greatest
interest are installed locally and update.packages() to make
sure you have the latest versions installed locally. Similarly, if
PackageSum2 does not contain complete interest on a package of
interest, this can be fixed by installing the package and rerunning
PackageSum2.
a data.frame with additional fields columns appended to a
package summary data.frame.
Spencer Graves
findFn
PackageSummary
installPackages
##
## data.frame method
##
tstdf <- data.frame(Package=c('grid', 'base'), stringsAsFactors=FALSE)
tst2 <- PackageSum2(tstdf)
##
## list method
##
tstList <- list(PackageSummary=tstdf)
all.equal(tst2, PackageSum2(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. <- PackageSum2(tst.findFn)
all.equal(tst2[, 1:7], tst2.[names(tst2)][, 1:7])