conv_times: Convert race times

Description Usage Arguments Details Examples

Description

Convert race times into more workable format. Most Horse Racing times are run in minutes, so times this function works on will be recorded as 'minutes:seconds:milliseconds' and 'seconds:milliseconds', which will be converted into seconds:milliseconds.

Usage

1
conv_times(times, regex = NULL)

Arguments

times

times to be converted

regex

specific regular expression to split times by (if function doesn't cater for the times entered)

Details

Takes a character string representing a race time, splits it up according to a regular expression that looks for punctuation, a space or the letter 'm' (full regex = "[[:punct:]]\s?|\s?[[:alpha:]]\s?|\s+"), so times like '1m39.99', '1 39.99' or '1.39.99' are split into '1', '39' and '99', it then recombines to return a numeric time in seconds. If there are any race times that this doesn't cater for then use the regex param to enter a specific regular expression to split the times by.

Examples

1
2
3
4
5
## Not run: 
times <- c("1.39.99", "1m39.99", "1 39.99")
conv_times(times = times)

## End(Not run)

durtal/RcappeR documentation built on May 15, 2019, 6 p.m.