R/get_assist.R

Defines functions get_assists

Documented in get_assists

#' Get assists from match report
#' @param df data.frame with goals scored (df_goals obtained from `get_match_report`)
#' @return character vector with assist names
#'
get_assists <- function(df) {

  df %>%
    dplyr::filter(X2 != "goals") %>%
    dplyr::pull(X2) %>%
    kb.utils::remove_everything_before(pattern = "\\(", x = .) %>%
    kb.utils::remove_everything_after(pattern = ")", x = .)

}
kristian-bak/football documentation built on Oct. 8, 2022, 2:11 p.m.