# 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
Run the code above in your browser using DataLab