#' Return a data frame of current NHL teams from NHL API.
#'
#' @export
#'
#' @examples
#' teams <- nhl_get_teams()
#' head(teams)
# Get teams
nhl_get_teams <- function() {
# Teams data
teams <- fromJSON("https://statsapi.web.nhl.com/api/v1/teams")
# Data frame with relevant info
out <- data.frame(
id = teams$teams$id,
name = teams$teams$teamName,
fullName = teams$teams$name,
abbr = teams$teams$abbreviation,
location = teams$teams$locationName,
division = teams$teams$division$name,
conference = teams$teams$conference$name
)
return(out)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.