#SUFC Reports
#Team Names
team_names <- function(match_report){
test <- match_report
file <- pdf_text(test)
file_page_1 <- file[1]
file_page_1 <- gsub("^ *|(?<= ) | *$", "", file_page_1, perl = TRUE)
file_page_1 <- strsplit(file_page_1, "\n", fixed = TRUE)
teams <- trimws(file_page_1[[1]][2], "both")
teams <- strsplit(teams, " ")
middle <- NULL
for(i in 1:length(teams[[1]])){
if(teams[[1]][i] == "-"){
middle <- i
}
}
home_team <- NULL
for(i in 1:middle - 1){
home_team[i] <- teams[[1]][i]
}
home_team <- paste(home_team, sep = " ", collapse = " ")
away_team <- NULL
for(i in (middle + 1):length(teams[[1]])){
away_team[i - (middle)] <- paste(teams[[1]][i], sep = " ", collapse = " ")
}
away_team <- paste(away_team, sep = " ", collapse = " ")
teams <- as.data.frame(cbind(home_team, away_team))
teams
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.