| PackageSummary {sos} | R Documentation |
Returns a matrix with one row for each package and columns
Count = number of rows in the search results for that package,
maxScore and totalScore = max and total score for help
pages found from that package.
PackageSummary(x, sortby=NULL)
x |
a data.frame with columns Package, Score, and
Date.
|
sortby |
a character vector specifying how the data.frame returned
should be sorted. Default = c('Count', 'MaxScore', 'TotalScore',
'Package') to sort descending on numerics and ascending on
alphnumerics. Specifying sortby = c('c', 't', 'm') is equivalent to
c('Count', 'TotalScore', 'MaxScore', 'Package', 'Score',
'Function').
Components of sortby must match either this list or
c('Score', 'Function', 'Date', 'Description', 'Link'). Any on this
latter list are ignored without a warning. This allows the same
sortby used for findFn to be used here.
|
a data.frame with one row for each package and columns Package,
Count, MaxScore, TotalScore, and Date,
sorted as specified by sort..
Spencer Graves
tstdf <- data.frame(Package=letters[c(1,1,2)], Score=2:4,
Date=LETTERS[1:3], stringsAsFactors=FALSE)
tstSum <- PackageSummary(tstdf)
# The answer:
tstSm <- data.frame(Package=letters[1:2], Count=c(a=2, b=1),
MaxScore=c(3, 4), TotalScore=c(5, 4),
Date=LETTERS[c(1, 3)], stringsAsFactors=FALSE)
row.names(tstSm) <- 1:2
all.equal(tstSum, tstSm)