Aggregate Rankings
Aggregate rankings, returning an "aggregated_rankings"
object of the
unique rankings and their frequencies. The frequencies can be extracted via
the function freq()
.
## S3 method for class 'rankings' aggregate(x, freq = NULL, ...) as.aggregated_rankings(x, ...) ## S3 method for class 'aggregated_rankings' x[i, j, ..., drop = FALSE, as.aggregated_rankings = TRUE] freq(x)
x |
A |
freq |
A vector of frequencies for rankings that have been previously aggregated. |
... |
Additional arguments, currently unused. |
i |
indices specifying rankings to extract, as for |
j |
indices specifying items to extract, as for |
drop |
if |
as.aggregated_rankings |
if |
A data frame of class "aggregated_rankings"
, with columns
ranking |
A |
freq |
The corresponding frequencies. |
Methods are available for rbind()
and as.matrix()
.
preflib()
for an object that can be coerced to an
"aggregated_rankings"
object.
# create a rankings object with duplicated rankings R <- matrix(c(1, 2, 0, 0, 0, 1, 2, 3, 2, 1, 1, 0, 1, 2, 0, 0, 2, 1, 1, 0, 1, 0, 3, 2), nrow = 6, byrow = TRUE) colnames(R) <- c("apple", "banana", "orange", "pear") R <- as.rankings(R) # aggregate the rankings A <- aggregate(R) # subsetting applies to the rankings, e.g. first two unique rankings A[1:2] # (partial) rankings of items 2 to 4 only A[, 2:4] # convert to a matrix as.matrix(A) # frequencies are automatically used as weights by PlackettLuce() mod <- PlackettLuce(A) mod$weights
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.