Description Usage Arguments Details Value Author(s) References See Also Examples
View source: R/PLMIXfunctions.R
Attempt to coerce the input data into a top-ordering dataset.
1 2 |
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). |
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.
An object of S3 class c("top_ordering","matrix")
.
Cristina Mollica and Luca Tardella
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
is.top_ordering
, as.rankings
and rankings
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | ## 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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.