#' Win in form record
#'
#' @param form A horse's form
#'
#' @return Boolean
ever_won <- function(form){
grepl("1", form)
}
#' Add a form index to output data
#'
#' @param df Pulled data
#'
#' @return Pulled data with noWinners column
#' @export
form_index <- function(df){
df <- df %>%
dplyr::mutate(form_index = purrr::map_lgl(metadata.FORM, ever_won)) %>%
dplyr::group_by(marketName, marketStartTime) %>%
dplyr::mutate(noWinners = all(!form_index)) %>%
dplyr::ungroup()
return(df)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.