Most Horse Racing times are recorded as ‘minutes:seconds:milliseconds’, data will typically be in character format, the conv_times
function converts these times into a time in ‘seconds.milliseconds’.
conv_times(times, regex = NULL)
param | details |
---|---|
times | times (in character format) to be converted |
regex | regular expression to split times by |
Takes a character string representing a race time, splits it up according to the regular expression [:punct:]]\\s?|\\s?[[:alpha:]]+\\s?|\\s+
, so times like 1m39.99, 1 39.99, 1 min 39.99 or 1:39.99 are split up into 1, 39 and 99 (ie. minutes, seconds, milliseconds). The function the converts these into seconds and sums them up, returning a numeric time in seconds. The regex
paramater allows for custom regular expressions to be entered.