#' Function To Convert Event Times
#'
#' This function converts match event times to numeric allowing for added time but not extra time
#' @keywords convert event time
#' @importFrom rvest %>%
#' @export
#' @examples
#' convert_time()
convert_time <- function(eventTime){
if(grepl("90'?\\+\\d+'?",eventTime)){
return(gsub("'","",eventTime) %>% gsub("90\\+","",.) %>% as.numeric() + 90)
}else if(grepl("45'?\\+\\d+'?",eventTime)){
return(45)
}else if(gsub("'?(\\+\\d+)?'?","",eventTime) %>% as.numeric() > 90){
return(NA)
}else{
return(gsub("'","",eventTime) %>% as.numeric())
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.