##
## data.frame method
##
Tstdf <- data.frame(Package=c('grid', 'base'),
stringsAsFactors=FALSE)
Tst2 <- PackageSum2(Tstdf)
##
## list method
##
TstList <- list(PackageSummary=Tstdf)
stopifnot(
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)
stopifnot(
all.equal(Tst2, Tst2.[names(Tst2)])
)
Run the code above in your browser using DataLab