#' Load Player URLs for Use in MLB_Player
#'
#' @param url url for loading
#'
#' @return
#' @export
#'
#' @import tidyverse
#' @import dplyr
#' @importFrom rvest html_nodes html_attr html_text
#' @importFrom xml2 read_html
#' @examples
#' #example used in MLB_Player.R
MLB_playerURL <- function(url) {
read.data <- read_html(url) %>%
html_nodes("#div_players_ a")
urls <- read.data %>%
html_attr("href") %>%
paste0('https://www.baseball-reference.com/', .) %>%
set_names(., nm = read.data %>% html_text)
return(urls)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.