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, ...)
# 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.

File inst/ordertable_to_ranktable.Rmd discusses the ranktable print method and also sets out a common gotcha for interpretation of the internal structure of ranktable objects.

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)

pentathlon_table  # an ordertable
#> An ordertable:
#>               shooting fencing swimming riding running
#> Moiseev              5       1        1      6       5
#> Zadneprovskis        6       2        5      5       1
#> Capalini             4       6        2      3       4
#> Cerkovskis           3       3        7      7       2
#> Meliakh              1       7        4      1       6
#> Michalik             2       4        6      2       7
#> Walther              7       5        3      4       3
as.ranktable(pentathlon_table) # coerce to a ranktable
#> A ranktable:
#>          c1            c2            c3         c4       c5           
#> shooting Meliakh       Michalik      Cerkovskis Capalini Moiseev      
#> fencing  Moiseev       Zadneprovskis Cerkovskis Michalik Walther      
#> swimming Moiseev       Capalini      Walther    Meliakh  Zadneprovskis
#> riding   Meliakh       Michalik      Capalini   Walther  Zadneprovskis
#> running  Zadneprovskis Cerkovskis    Walther    Capalini Moiseev      
#>          c6            c7        
#> shooting Zadneprovskis Walther   
#> fencing  Capalini      Meliakh   
#> swimming Michalik      Cerkovskis
#> riding   Moiseev       Cerkovskis
#> running  Meliakh       Michalik