formula1.RdRace results from 2017 Formula One World Championship
data(formula1)
formula1_points_systems(top=11)A hyper2 object that gives a likelihood function
Object formula1 is a hyper2 object that gives a likelihood
function for the strengths of the competitors of the 2017 Formula One
(Drivers') World Championship. Object F1_table_2017 is an order table: a
data frame with rows being drivers, columns being venues, and entries
being places. Thus looking at the first row, first column we see that
Hamilton placed second in Austria.
The package uses files like inst/formula1_2017.txt as primary
sources. These are generally copied from wikipedia, converted into
tab-separated clean seven bit ascii, and tidied up a little. I have
removed diacritics from names, so we see “Raikkonen”,
“Perez”, etc. Also where distinct drivers with the same
surname compete, I have indicated this, e.g. schumacher_R is Ralf
Schumacher, schumacher_M is Michael, and schumacher_Mick
is Mick; the underscore device means that quoting should not be needed
in R idiom. I have not been entirely consistent here, with Bruno Senna
appearing as “Senna_B” and Nelson Piquet Junior appearing
as “PiquetJ” [on the grounds that in these cases the
fathers, being more eminent, should be the primary eponym] although this might
change in the future.
Object F1_table_2017 is simply the first 20 columns of
read.table(inst/formula1_2017.txt) and object
F1_points_2017 is column 21. The final column of all the text
files is the points and it is easy to mistake this for a venue with
results (doing so will give a “Error in ordervec2supp(o) :
nonzero elements of d should be 1,2,3,4,...,n” error).
The likelihood function formula1 is
ordertable2supp(F1_table_2017) [NB: suppfun(F1_table_2017)
fails: suppfun() will not try to guess whether its argument is a
ranktable or an ordertable]. The datasets in the package are derived
from text files in the inst/ directory
(e.g. formula1_2017.txt) by script file
inst/f1points_Omaker.R. Executing this script creates files like
formula1_results_2017.rda.
The text files can be converted directly into ranktable objects
and support functions as follows:
a <- read.table("formula1_2022.txt",header=TRUE)
a <- a[,seq_len(ncol(a)-1)] # strips out the points column
wikitable_to_ranktable(a)
ordertable2supp(a) # works fine
suppfun(ordertable(a)) # Same as previous line, but suppfun() needs to know what its argument isTo convert to a numeric matrix with DNS etc converted to
NA:
a <- read.table("formula1_2024.txt",header=TRUE)
a <- a[, -ncol(a)]
a <- as.matrix(a)
storage.mode(a) <- "numeric"[this is used in file inst/test_formula1.R, which provides a
consistency check for files inst/formula1_???.txt].
Function formula1_points_system() gives various possible points
systems for the winner, second, third, etc, placing drivers.
The constructors' championship is discussed at constructor.Rd.
There is a large amount of documentation in the inst/ directory
in the form of Rmd files.
“Wikipedia contributors”, 2017 Formula One World Championship—Wikipedia, The Free Encyclopedia, 2018. https://en.wikipedia.org/w/index.php?title=2017_Formula_One_World_Championship&oldid=839923210 [Online; accessed 14-May-2018]
summary(formula1)
#> A hyper2 object of size 25.
#> pnames: Alonso Bottas Button Ericsson Gasly Giovinazzi Grosjean Hamilton Hartley Hulkenberg Kvyat Magnussen Massa Ocon Palmer Perez Raikkonen Resta Ricciardo Sainz Stroll Vandoorne Verstappen Vettel Wehrlein
#> Number of brackets: 262
#> Sum of powers: 0
#>
#> Table of bracket lengths:
#> 1 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
#> 23 3 6 12 16 18 19 20 19 20 19 19 19 11 12 12 8 5 1
#>
#> Table of powers:
#> -20 -9 -6 -5 -4 -3 -2 -1 1 2 5 11 12 13 14 15 16 17 18 19
#> 1 1 3 1 3 4 12 214 1 1 1 3 1 1 4 2 1 3 1 3
#> 20
#> 1
if (FALSE) #Takes too long
dotchart(maxp(formula1))
# \dontrun{}