#' @title Get Triple Doubles
#' @param player a string representing a player's name
#' @param years vector of years corresponding to player names
#' @description Gets Player Game Logs
#' @keywords NBA basketball-reference
#' @importFrom magrittr %>%
#' @export
#' @examples
#' #' get_triple_doubles("magic johnson", c(1983, 1984))
# will return game logs for games where requested player scored triple doubles
# (currently only searches for traditional triple doubles: points, rebounds, assists)
get_triple_doubles <- function(player, years) {
player <- c(player)
game_logs <- player_game_logs(player, years)
trip_doub_lst <- list()
for (i in 1:length(game_logs)) {
#subset game logs to just triple doubles
trip_doub_df <- game_logs[[i]] %>%
subset(points >= 10 & tot_reb >= 10 & assists >= 10)
#get year
year <- as.character(years[i])
#store in list
trip_doub_lst[[year]] <- trip_doub_df
}
return(trip_doub_lst)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.