Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

choices

Choices Object


Description

Convert a set of rankings to a list of choices, alternatives, and rankings. The choices and the corresponding alternatives make up the exchangeable part of the Plackett-Luce with ties.

Usage

choices(rankings, names = FALSE)

Arguments

rankings

a "rankings" object, or an object that can be coerced by as.rankings.

names

logical: if TRUE use the object names in the returned "choices" object, else use object indices.

Value

A data frame of class "choices" with elements:

choices

A list where each element represents the set of items chosen for a single rank in the ranking.

alternatives

A list where each element represents the set of items to choose from for a single rank in the ranking.

ranking

A list where each element represents the ranking that the choice belongs to.

The list stores the number of choices and the names of the objects as the attributes "nchoices" and "objects" respectively.

Examples

R <- matrix(c(1, 2, 0, 0,
              4, 1, 2, 3,
              2, 1, 1, 1,
              1, 2, 3, 0,
              2, 1, 1, 0,
              1, 0, 3, 2), nrow = 6, byrow = TRUE)
colnames(R) <- c("apple", "banana", "orange", "pear")

actual_choices <- choices(R, names = TRUE)
actual_choices[1:6,]

coded_choices <- choices(R, names = FALSE)
coded_choices[1:2,]
as.data.frame(coded_choices)[1:2,]
attr(coded_choices, "objects")

PlackettLuce

Plackett-Luce Models for Rankings

v0.4.0
GPL-3
Authors
Heather Turner [aut, cre] (<https://orcid.org/0000-0002-1256-3375>), Ioannis Kosmidis [aut] (<https://orcid.org/0000-0003-1556-0302>), David Firth [aut] (<https://orcid.org/0000-0003-0302-2312>), Jacob van Etten [ctb] (<https://orcid.org/0000-0001-7554-2558>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.