Given an ordertable such as F1_table_2017 which is a “wikitable” object, function as.ordertable() returns a nicified version in which entries such as DNS are replaced with zeros. Finishing competitors are assigned numbers \(1-n\) with no gaps; the function can be used to extract a subset of competitors.

Function ordertable2supp() offers similar functionality but returns a hyper2 object directly.

as.ordertable(w)

Arguments

w

A generalized ordertable, a wikitable

Details

Operates columnwise, and treats any entry not coercible to numeric as DNF.

Value

Returns an ordertable suitable for coercion to a hyper2 object.

Author

Robin K. S. Hankin

Examples


as.ordertable(F1_table_2017)
#>            AUS CHN BHR RUS ESP MON CAN AZE AUT GBR HUN BEL ITA SIN MAL JPN USA
#> Hamilton     2   1   2   4   1   7   1   5   4   1   4   1   1   1   2   1   1
#> Vettel       1   2   1   2   2   1   4   4   2   7   1   2   3   0   4   0   2
#> Bottas       3   6   3   1   0   4   2   2   1   2   3   5   2   3   5   4   5
#> Raikkonen    4   5   4   3   0   2   7  14   5   3   2   4   5   0   0   5   3
#> Ricciardo    0   4   5   0   3   3   3   1   3   5   0   3   4   2   3   3   0
#> Verstappen   5   3   0   5   0   5   0   0   0   4   5   0  10   0   1   2   4
#> Perez        7   9   7   6   4  13   5   0   7   9   8  17   9   5   6   7   8
#> Ocon        10  10  10   7   5  12   6   6   8   8   9   9   6  10  10   6   6
#> Sainz        8   7   0  10   7   6   0   8   0   0   7  10  14   4   0   0   7
#> Hulkenberg  11  12   9   8   6   0   8   0  13   6  17   6  13   0  16   0   0
#> Massa        6  14   6   9  13   9   0   0   9  10   0   8   8  11   9  10   9
#> Stroll       0   0   0  11  16  15   9   3  10  16  14  11   7   8   8   0  11
#> Grosjean     0  11   8   0  10   8  10  13   6  13   0   7  15   9  13   9  14
#> Magnussen    0   8   0  13  14  10  12   7   0  12  13  15  11   0  12   8  16
#> Alonso       0   0  14   0  12   0  16   9   0   0   6   0  17   0  11  11   0
#> Vandoorne   13   0   0  14   0   0  14  12  12  11  10  14   0   7   7  14  12
#> Palmer       0  13  13   0  15  11  11   0  11   0  12  13   0   6  15  12   0
#> Wehrlein     0   0  11  16   8   0  15  10  14  17  15   0  16  12  17  15   0
#> Kvyat        9   0  12  12   9  14   0   0  16  15  11  12  12   0   0   0  10
#> Ericsson     0  15   0  15  11   0  13  11  15  14  16  16  18   0  18   0  15
#> Gasly        0   0   0   0   0   0   0   0   0   0   0   0   0   0  14  13   0
#> Giovinazzi  12   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
#> Hartley      0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0  13
#> Button       0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
#> Resta        0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
#>            MEX BRA ABU
#> Hamilton     9   4   2
#> Vettel       4   1   3
#> Bottas       2   2   1
#> Raikkonen    3   3   4
#> Ricciardo    0   6   0
#> Verstappen   1   5   5
#> Perez        7   9   7
#> Ocon         5   0   8
#> Sainz        0  11   0
#> Hulkenberg   0  10   6
#> Massa       11   7  10
#> Stroll       6  16  18
#> Grosjean    15  15  11
#> Magnussen    8   0  13
#> Alonso      10   8   9
#> Vandoorne   12   0  12
#> Palmer       0   0   0
#> Wehrlein    14  14  14
#> Kvyat        0   0   0
#> Ericsson     0  13  17
#> Gasly       13  12  16
#> Giovinazzi   0   0   0
#> Hartley      0   0  15
#> Button       0   0   0
#> Resta        0   0   0
ordertable2supp(as.ordertable(F1_table_2017[1:9,]))
#> log(Bottas^19 * (Bottas + Hamilton + Ocon + Perez + Raikkonen +
#> Ricciardo + Sainz + Verstappen)^-5 * (Bottas + Hamilton + Ocon + Perez
#> + Raikkonen + Ricciardo + Sainz + Verstappen + Vettel)^-20 * (Bottas +
#> Hamilton + Ocon + Perez + Raikkonen + Ricciardo + Sainz + Vettel)^-2 *
#> (Bottas + Hamilton + Ocon + Perez + Raikkonen + Sainz + Verstappen +
#> Vettel)^-1 * (Bottas + Hamilton + Ocon + Perez + Ricciardo + Sainz +
#> Verstappen)^-2 * (Bottas + Hamilton + Ocon + Perez + Sainz +
#> Verstappen)^-1 * (Bottas + Ocon + Perez + Raikkonen + Ricciardo +
#> Sainz)^-1 * (Bottas + Ocon + Perez + Raikkonen + Ricciardo + Sainz +
#> Verstappen)^-6 * (Bottas + Ocon + Perez + Raikkonen + Ricciardo + Sainz
#> + Verstappen + Vettel)^-9 * (Bottas + Ocon + Perez + Raikkonen +
#> Ricciardo + Sainz + Vettel)^-2 * (Bottas + Ocon + Perez + Raikkonen +
#> Sainz)^-2 * (Bottas + Ocon + Perez + Raikkonen + Sainz + Verstappen)^-2
#> * (Bottas + Ocon + Perez + Raikkonen + Sainz + Verstappen + Vettel)^-1
#> * (Bottas + Ocon + Perez + Raikkonen + Sainz + Vettel)^-2 * (Bottas +
#> Ocon + Perez + Ricciardo + Sainz)^-1 * (Bottas + Ocon + Perez +
#> Ricciardo + Sainz + Verstappen)^-1 * (Bottas + Ocon + Perez + Sainz)^-1
#> * (Bottas + Ocon + Perez + Sainz + Verstappen)^-1 * (Bottas + Ocon +
#> Raikkonen + Sainz + Verstappen)^-1 * (Bottas + Raikkonen + Sainz +
#> Verstappen)^-1 * Hamilton^20 * (Hamilton + Ocon + Perez)^-1 * (Hamilton
#> + Ocon + Perez + Raikkonen + Ricciardo + Sainz + Verstappen)^-3 *
#> (Hamilton + Ocon + Perez + Raikkonen + Ricciardo + Sainz + Verstappen +
#> Vettel)^-3 * (Hamilton + Ocon + Perez + Raikkonen + Ricciardo + Sainz +
#> Vettel)^-1 * (Hamilton + Ocon + Perez + Raikkonen + Sainz +
#> Verstappen)^-2 * (Hamilton + Ocon + Perez + Raikkonen + Sainz +
#> Verstappen + Vettel)^-1 * (Hamilton + Ocon + Perez + Ricciardo +
#> Sainz)^-1 * (Hamilton + Ocon + Perez + Ricciardo + Sainz +
#> Verstappen)^-3 * (Hamilton + Ocon + Perez + Ricciardo + Sainz +
#> Vettel)^-1 * (Hamilton + Ocon + Perez + Sainz)^-1 * (Hamilton + Ocon +
#> Perez + Sainz + Verstappen)^-1 * (Hamilton + Perez + Ricciardo +
#> Sainz)^-1 * (Hamilton + Ricciardo + Sainz)^-1 * Ocon^18 * (Ocon +
#> Perez)^-2 * (Ocon + Perez + Raikkonen + Ricciardo + Sainz +
#> Verstappen)^-4 * (Ocon + Perez + Raikkonen + Ricciardo + Sainz +
#> Verstappen + Vettel)^-4 * (Ocon + Perez + Raikkonen + Sainz)^-1 * (Ocon
#> + Perez + Raikkonen + Sainz + Verstappen)^-4 * (Ocon + Perez +
#> Raikkonen + Sainz + Verstappen + Vettel)^-2 * (Ocon + Perez + Raikkonen
#> + Sainz + Vettel)^-1 * (Ocon + Perez + Raikkonen + Verstappen +
#> Vettel)^-1 * (Ocon + Perez + Ricciardo)^-1 * (Ocon + Perez + Ricciardo
#> + Sainz)^-6 * (Ocon + Perez + Ricciardo + Sainz + Verstappen)^-6 *
#> (Ocon + Perez + Ricciardo + Sainz + Verstappen + Vettel)^-1 * (Ocon +
#> Perez + Ricciardo + Sainz + Vettel)^-1 * (Ocon + Perez + Sainz)^-3 *
#> (Ocon + Perez + Sainz + Verstappen)^-4 * (Ocon + Perez + Sainz +
#> Vettel)^-2 * (Ocon + Raikkonen + Sainz)^-1 * (Ocon + Raikkonen + Sainz
#> + Verstappen)^-1 * (Ocon + Raikkonen + Verstappen + Vettel)^-1 * (Ocon
#> + Ricciardo)^-2 * (Ocon + Ricciardo + Sainz)^-3 * (Ocon + Sainz)^-1 *
#> (Ocon + Sainz + Verstappen)^-2 * Perez^18 * (Perez + Raikkonen + Sainz
#> + Verstappen)^-1 * (Perez + Raikkonen + Verstappen)^-1 * (Perez +
#> Ricciardo)^-1 * (Perez + Ricciardo + Sainz)^-1 * (Perez + Sainz)^-1 *
#> (Perez + Sainz + Verstappen)^-2 * (Perez + Sainz + Vettel)^-1 * (Perez
#> + Verstappen)^-1 * Raikkonen^17 * (Raikkonen + Sainz + Verstappen)^-1 *
#> Ricciardo^14 * (Ricciardo + Sainz)^-1 * Sainz^11 * (Sainz +
#> Verstappen)^-1 * Verstappen^13 * Vettel^18)