Convert rank tables (as generated by rrank(), for example) to order tables like the formula 1 tables; and convert back. Print and summary methods for rank tables are documented here. See also ordertable.Rd.

ranktable_to_ordertable(xrank)
ordertable_to_ranktable(xorder)
wikitable_to_ranktable(wikitable, strict=FALSE)
# S3 method for class 'ranktable'
summary(object, ...)
ranktable_to_printable_object(x)
# S3 method for class 'ranktablesummary'
print(x,...)

Arguments

x,xrank,object

A rank table, an object with class ranktable, for example the value of rrank()

xorder,wikitable

Order tables. Argument wikitable refers to a generalized order table which can include entries such as DNF signifying did not finish.

strict

Controls for wikitable_to_ranktable()

...

Further arguments (currently ignored)

Details

Function ranktable_to_ordertable() is trivial; ordertable_to_ranktable() less so. The prototype for order tables would be skating_table.

Function ordertable_to_ranktable(x) checks for each column being a permutation of seq_len(nrow(x)) and, if not, it stops. In particular, DNF entries are out of scope. To convert order tables such as F1_table_2017, which include DNF entries, use wikitable_to_ranktable() or ordertable2supp() to produce a likelihood function.

Function ranktable_to_printable_object() is a helper function that coerces a ranktable object to a matrix that prints nicely.

The print method is discussed in inst/ordertable_to_ranktable.Rmd.

Value

An order table or rank table

Author

Robin K. S. Hankin

Examples


p <- (5:1)/15
names(p) <- letters[1:5]
xrank <- rrank(12,p,rnames=month.abb)
xorder <- ranktable_to_ordertable(xrank)

## Can convert back and forth:
identical(xrank,ordertable_to_ranktable(ranktable_to_ordertable(xrank)))
#> [1] TRUE

# maxp(ordertable2supp(xorder))  # should be close to p
ordertable_to_ranktable(skating_table)
#>    c1        c2        c3        c4        c5         c6         c7        
#> J1 hughes    kwan      slutskaya suguri    cohen      butyrskaya robinson  
#> J2 slutskaya cohen     kwan      hughes    butyrskaya volchkova  robinson  
#> J3 slutskaya kwan      hughes    cohen     suguri     liashenko  robinson  
#> J4 slutskaya kwan      cohen     hughes    suguri     kettunen   butyrskaya
#> J5 hughes    kwan      cohen     slutskaya suguri     robinson   sebestyen 
#> J6 slutskaya hughes    kwan      cohen     butyrskaya sebestyen  suguri    
#> J7 hughes    slutskaya kwan      cohen     suguri     volchkova  kettunen  
#> J8 hughes    kwan      slutskaya cohen     suguri     robinson   butyrskaya
#> J9 hughes    slutskaya kwan      cohen     suguri     butyrskaya robinson  
#>    c8         c9          c10         c11         c12         c13        
#> J1 sebestyen  kettunen    volchkova   onda        hubert      maniachenko
#> J2 suguri     kettunen    sebestyen   fontana     maniachenko liashenko  
#> J3 butyrskaya meier       onda        maniachenko sebestyen   kettunen   
#> J4 sebestyen  robinson    liashenko   volchkova   maniachenko hubert     
#> J5 liashenko  fontana     volchkova   hubert      butyrskaya  kettunen   
#> J6 robinson   meier       kettunen    maniachenko volchkova   onda       
#> J7 butyrskaya fontana     robinson    maniachenko sebestyen   liashenko  
#> J8 sebestyen  volchkova   maniachenko kettunen    fontana     onda       
#> J9 sebestyen  maniachenko fontana     onda        meier       hubert     
#>    c14       c15       c16         c17       c18       c19       c20      
#> J1 fontana   liashenko meier       gusmeroli giunchi   soldatova hegel    
#> J2 onda      gusmeroli meier       hubert    soldatova giunchi   babiakova
#> J3 volchkova gusmeroli hegel       hubert    fontana   babiakova giunchi  
#> J4 meier     onda      fontana     gusmeroli kopac     babiakova soldatova
#> J5 meier     onda      maniachenko gusmeroli hegel     giunchi   babiakova
#> J6 liashenko fontana   hubert      soldatova gusmeroli hegel     giunchi  
#> J7 hubert    onda      meier       gusmeroli soldatova babiakova giunchi  
#> J8 liashenko hubert    meier       gusmeroli soldatova hegel     giunchi  
#> J9 kettunen  volchkova liashenko   gusmeroli hegel     soldatova giunchi  
#>    c21       c22       c23  
#> J1 kopac     babiakova luca 
#> J2 hegel     kopac     luca 
#> J3 luca      soldatova kopac
#> J4 giunchi   hegel     luca 
#> J5 soldatova kopac     luca 
#> J6 babiakova kopac     luca 
#> J7 hegel     kopac     luca 
#> J8 kopac     babiakova luca 
#> J9 kopac     babiakova luca 

# convert a rank table to a support function:
rank_likelihood(wikitable_to_ranktable(volvo_table))
#> log(AbuDhabi^9 * (AbuDhabi + Alvimedica + Brunel + Dongfeng + MAPFRE +
#> SCA + Vestas)^-9 * (AbuDhabi + Alvimedica + Brunel + MAPFRE + SCA +
#> Vestas)^-2 * (AbuDhabi + Alvimedica + Dongfeng + MAPFRE + SCA +
#> Vestas)^-3 * (AbuDhabi + Alvimedica + MAPFRE + SCA + Vestas)^-1 *
#> (AbuDhabi + Brunel)^-1 * (AbuDhabi + Brunel + Dongfeng + MAPFRE + SCA +
#> Vestas)^-2 * (AbuDhabi + Brunel + MAPFRE + SCA)^-1 * (AbuDhabi + Brunel
#> + MAPFRE + SCA + Vestas)^-1 * (AbuDhabi + Brunel + SCA)^-1 * (AbuDhabi
#> + Dongfeng + MAPFRE + SCA + Vestas)^-3 * (AbuDhabi + Dongfeng + SCA +
#> Vestas)^-1 * (AbuDhabi + MAPFRE + SCA + Vestas)^-1 * (AbuDhabi + SCA +
#> Vestas)^-1 * Alvimedica^9 * (Alvimedica + Brunel + Dongfeng + MAPFRE +
#> SCA + Vestas)^-2 * (Alvimedica + Brunel + Dongfeng + SCA + Vestas)^-1 *
#> (Alvimedica + Brunel + Dongfeng + Vestas)^-1 * (Alvimedica + Brunel +
#> MAPFRE + SCA + Vestas)^-2 * (Alvimedica + Dongfeng + Vestas)^-1 *
#> (Alvimedica + MAPFRE + SCA)^-1 * (Alvimedica + MAPFRE + SCA +
#> Vestas)^-3 * (Alvimedica + SCA + Vestas)^-2 * (Alvimedica + Vestas)^-1
#> * Brunel^8 * (Brunel + Dongfeng + MAPFRE + SCA + Vestas)^-1 * (Brunel +
#> Dongfeng + SCA + Vestas)^-1 * Dongfeng^9 * (Dongfeng + MAPFRE + SCA +
#> Vestas)^-1 * (Dongfeng + SCA + Vestas)^-2 * MAPFRE^8 * (MAPFRE +
#> SCA)^-1 * (MAPFRE + SCA + Vestas)^-1 * SCA^8 * (SCA + Vestas)^-6 *
#> Vestas^3)