PackageSum2 {RSiteSearch} | R Documentation |
Add information on installed packages to the PackageSummary
of
an RSiteSearch
object.
PackageSum2(x, fields=c("Title", "Version", "Author", "Maintainer", "Packaged"), lib.loc=NULL, ...) ## S3 method for class 'RSiteSearch': PackageSum2(x, fields=c("Title", "Version", "Author", "Maintainer", "Packaged"), lib.loc=NULL, ...) ## S3 method for class 'data.frame': PackageSum2(x, fields=c("Title", "Version", "Author", "Maintainer", "Packaged"), lib.loc=NULL, ...) ## S3 method for class 'list': PackageSum2(x, fields=c("Title", "Version", "Author", "Maintainer", "Packaged"), lib.loc=NULL, ...)
x |
a data.frame with columns Package and Score .
|
fields |
character vector of names to look for in components of
packageDescription(x$Package[i]) and return as additional
columns of x if found.
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 RSiteSearch
, 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 RSiteSearch
object, add
other columns from attributes
of packageDescription
for
installed packages named in the column Package
.
a data.frame with additional fields
columns appended to
x
.
Spencer Graves
RSiteSearch.function
PackageSummary
## ## data.frame method ## tstdf <- data.frame(Package=c('fda', 'base'), stringsAsFactors=FALSE) tst2 <- PackageSum2(tstdf) ## ## list method ## tstList <- list(PackageSummary=tstdf) all.equal(tst2, PackageSum2(tstList)) ## ## RSiteSearch method ## tstRSearch <- data.frame(Package=c('fda', 'base')[c(1,1,2)], Score=2:4, Date=LETTERS[1:3], stringsAsFactors=FALSE) attr(tstRSearch, 'PackageSummary') <- PackageSummary(tstRSearch) class(tstRSearch) <- c('RSiteSearch', 'data.frame') tst2. <- PackageSum2(tstRSearch) # row names are different from tst2, so fix ... row.names(tst2.) <- row.names(tst2) all.equal(tst2, tst2.[names(tst2)])