as.top_ordering {PLMIX} | R Documentation |
Coercion into top-ordering datasets
Description
Attempt to coerce the input data into a top-ordering dataset.
Usage
as.top_ordering(data, format_input = NULL, aggr = NULL,
freq_col = NULL, ties_method = "random", ...)
Arguments
data |
An object containing the partial sequences to be coerced into an object of class |
format_input |
Character string indicating the format of the |
aggr |
Logical: whether the |
freq_col |
Integer indicating the column of the |
ties_method |
Character string indicating the treatment of sequences with ties (not used for data of class |
... |
Further arguments passed to or from other methods (not used). |
Details
The coercion function as.top_ordering
tries to coerce the input data into an object of class top_ordering
after checking for possible partial sequences that do not satisfy the top-ordering requirements. If none of the supplied sequences satisfies the top-ordering conditions, an error message is returned. NA
's in the input data
are tacitly converted into zero entries.
Value
An object of S3 class c("top_ordering","matrix")
.
Author(s)
Cristina Mollica and Luca Tardella
References
Turner, H., Kormidis, I. and Firth, D. (2018). PlackettLuce: Plackett-Luce Models for Rankings. R package version 0.2-3. https://CRAN.R-project.org/package=PlackettLuce
Qian, Z. (2018). rankdist: Distance Based Ranking Models. R package version 1.1.3. https://CRAN.R-project.org/package=rankdist
See Also
is.top_ordering
, as.rankings
and rankings
Examples
## Coerce an object of class 'rankings' into an object of class 'top_ordering'
library(PlackettLuce)
RR <- 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)
RR_rank=as.rankings(RR)
RR_rank
as.top_ordering(RR_rank, ties_method="random")
## Coerce an object of class 'RankData' into an object of class 'top_ordering'
library(rankdist)
data(apa_partial_obj)
d_apa_top_ord=as.top_ordering(data=apa_partial_obj)
identical(d_apa,d_apa_top_ord)
## Coerce a data frame from the package prefmod into an object of class 'top_ordering'
library(prefmod)
data(carconf)
carconf_rank=carconf[,1:6]
carconf_top_ord=as.top_ordering(data=carconf_rank,format_input="ranking",aggr=FALSE)
identical(d_carconf,carconf_top_ord)
## Coerce a data frame from the package pmr into an object of class 'top_ordering'
library(pmr)
data(big4)
head(big4)
big4_top_ord=as.top_ordering(data=big4,format_input="ranking",aggr=TRUE,freq_col=5)
head(big4_top_ord)