From 8e217ecab9423569efc984a7451acaa8e510cde4 Mon Sep 17 00:00:00 2001 From: saiemgilani Date: Sat, 25 Nov 2023 04:42:09 -0500 Subject: [PATCH] Feat: added `on_court` parameter to `nba_pbp()` and `nba_pbps()` functions --- R/nba_stats_pbp.R | 6 +++--- R/utils.R | 2 +- man/dot-players_on_court.Rd | 8 ++++++++ man/nba_pbp.Rd | 2 +- man/nba_pbps.Rd | 2 +- 5 files changed, 14 insertions(+), 6 deletions(-) create mode 100644 man/dot-players_on_court.Rd diff --git a/R/nba_stats_pbp.R b/R/nba_stats_pbp.R index 1333aef6..60032d61 100644 --- a/R/nba_stats_pbp.R +++ b/R/nba_stats_pbp.R @@ -134,7 +134,7 @@ NULL tmp_gameid <- pbp_data$game_id[1] } - tmp_data <- hoopR::nba_boxscoretraditionalv2(game_id = tmp_gameid, start_period = x, end_period = x, range_type = 1)$PlayerStats + tmp_data <- nba_boxscoretraditionalv2(game_id = tmp_gameid, start_period = x, end_period = x, range_type = 1)$PlayerStats all_id <- as.integer(tmp_data$PLAYER_ID) @@ -276,7 +276,7 @@ NULL #' ``` nba_pbp <- function( game_id, - on_court = FALSE, + on_court = TRUE, version = "v2", p, ...){ @@ -467,7 +467,7 @@ NULL #' ``` nba_pbps <- function( game_ids = NULL, - on_court = FALSE, + on_court = TRUE, version = "v2", nest_data = FALSE, ...) { diff --git a/R/utils.R b/R/utils.R index 5a3a9492..84c78be1 100644 --- a/R/utils.R +++ b/R/utils.R @@ -175,7 +175,7 @@ custom_mode <- function(x, na.rm = TRUE) { #' @export most_recent_mbb_season <- function() { ifelse( - as.double(substr(Sys.Date(), 6, 7)) >= 10, + as.double(substr(Sys.Date(), 6, 7)) > 10, as.double(substr(Sys.Date(), 1, 4)) + 1, as.double(substr(Sys.Date(), 1, 4)) ) diff --git a/man/dot-players_on_court.Rd b/man/dot-players_on_court.Rd new file mode 100644 index 00000000..2ce0d549 --- /dev/null +++ b/man/dot-players_on_court.Rd @@ -0,0 +1,8 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/nba_stats_pbp.R +\name{.players_on_court} +\alias{.players_on_court} +\title{\strong{Add players on court in NBA Stats API play-by-play}} +\description{ +\strong{Add players on court in NBA Stats API play-by-play} +} diff --git a/man/nba_pbp.Rd b/man/nba_pbp.Rd index b0b990d0..6231627a 100644 --- a/man/nba_pbp.Rd +++ b/man/nba_pbp.Rd @@ -4,7 +4,7 @@ \alias{nba_pbp} \title{\strong{Get NBA Stats API play-by-play}} \usage{ -nba_pbp(game_id, on_court = FALSE, version = "v2", p, ...) +nba_pbp(game_id, on_court = TRUE, version = "v2", p, ...) } \arguments{ \item{game_id}{Game ID} diff --git a/man/nba_pbps.Rd b/man/nba_pbps.Rd index 1426b6bc..c787d492 100644 --- a/man/nba_pbps.Rd +++ b/man/nba_pbps.Rd @@ -6,7 +6,7 @@ \usage{ nba_pbps( game_ids = NULL, - on_court = FALSE, + on_court = TRUE, version = "v2", nest_data = FALSE, ...