Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moved functions that have 2001 data to accepting 2001 as a valid year #114

Merged
merged 1 commit into from
May 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion R/kp_misc_stats.R
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ kp_game_attrs <- function(
#' try(kp_fanmatch(date="2022-02-22"))
#' }

kp_fanmatch <- function(date = "2022-02-22"){
kp_fanmatch <- function(date){
tryCatch(
expr = {
if (!has_kp_user_and_pw()) stop("This function requires a KenPom subscription e-mail and password combination, set as the system environment variables KP_USER and KP_PW.", "\n See ?kp_user_pw for details.", call. = FALSE)
Expand Down
20 changes: 10 additions & 10 deletions R/kp_ratings_tables.R
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ kp_pomeroy_ratings <- function(min_year, max_year = most_recent_mbb_season()){
expr = {
if (!has_kp_user_and_pw()) stop("This function requires a KenPom subscription e-mail and password combination,\n set as the system environment variables KP_USER and KP_PW.", "\n See ?kp_user_pw for details.", call. = FALSE)
browser <- login()
if (!(is.numeric(min_year) && nchar(min_year) == 4 && min_year >= 2002)) {
if (!(is.numeric(min_year) && nchar(min_year) == 4 && min_year >= 2001)) {
# Check if year is numeric, if not NULL
cli::cli_abort("Enter valid min_ as a number (YYYY), data only goes back to 2002")
cli::cli_abort("Enter valid min_ as a number (YYYY), data only goes back to 2001")
}

years <- min_year:max_year
Expand Down Expand Up @@ -166,9 +166,9 @@ kp_efficiency <- function(min_year, max_year = most_recent_mbb_season()){
expr = {
if (!has_kp_user_and_pw()) stop("This function requires a KenPom subscription e-mail and password combination,\n set as the system environment variables KP_USER and KP_PW.", "\n See ?kp_user_pw for details.", call. = FALSE)
browser <- login()
if (!(is.numeric(min_year) && nchar(min_year) == 4 && min_year >= 2002)) {
if (!(is.numeric(min_year) && nchar(min_year) == 4 && min_year >= 2001)) {
# Check if year is numeric, if not NULL
cli::cli_abort("Enter valid min_year as a number (YYYY), data only goes back to 2002")
cli::cli_abort("Enter valid min_ as a number (YYYY), data only goes back to 2001")
}


Expand Down Expand Up @@ -340,9 +340,9 @@ kp_fourfactors <- function(min_year, max_year = most_recent_mbb_season()){
expr = {
if (!has_kp_user_and_pw()) stop("This function requires a KenPom subscription e-mail and password combination,\n set as the system environment variables KP_USER and KP_PW.", "\n See ?kp_user_pw for details.", call. = FALSE)
browser <- login()
if (!(is.numeric(min_year) && nchar(min_year) == 4 && min_year >= 2002)) {
if (!(is.numeric(min_year) && nchar(min_year) == 4 && min_year >= 2001)) {
# Check if year is numeric, if not NULL
cli::cli_abort("Enter valid min_year as a number (YYYY), data only goes back to 2002")
cli::cli_abort("Enter valid min_ as a number (YYYY), data only goes back to 2001")
}


Expand Down Expand Up @@ -458,9 +458,9 @@ kp_pointdist <- function(min_year, max_year = most_recent_mbb_season()){
expr = {
if (!has_kp_user_and_pw()) stop("This function requires a KenPom subscription e-mail and password combination,\n set as the system environment variables KP_USER and KP_PW.", "\n See ?kp_user_pw for details.", call. = FALSE)
browser <- login()
if (!(is.numeric(min_year) && nchar(min_year) == 4 && min_year >= 2002)) {
if (!(is.numeric(min_year) && nchar(min_year) == 4 && min_year >= 2001)) {
# Check if year is numeric, if not NULL
cli::cli_abort("Enter valid min_year as a number (YYYY), data only goes back to 2002")
cli::cli_abort("Enter valid min_ as a number (YYYY), data only goes back to 2001")
}


Expand Down Expand Up @@ -884,9 +884,9 @@ kp_teamstats <- function(min_year, max_year=most_recent_mbb_season()){
expr = {
if (!has_kp_user_and_pw()) stop("This function requires a KenPom subscription e-mail and password combination,\n set as the system environment variables KP_USER and KP_PW.", "\n See ?kp_user_pw for details.", call. = FALSE)
browser <- login()
if (!(is.numeric(min_year) && nchar(min_year) == 4 && min_year >= 2002)) {
if (!(is.numeric(min_year) && nchar(min_year) == 4 && min_year >= 2001)) {
# Check if year is numeric, if not NULL
cli::cli_abort("Enter valid min_year as a number (YYYY), data only goes back to 2002")
cli::cli_abort("Enter valid min_ as a number (YYYY), data only goes back to 2001")
}


Expand Down
13 changes: 6 additions & 7 deletions R/kp_team_tables.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ kp_team_schedule <- function(team, year = 2022){
expr = {
if (!has_kp_user_and_pw()) stop("This function requires a KenPom subscription e-mail and password combination,\n set as the system environment variables KP_USER and KP_PW.", "\n See ?kp_user_pw for details.", call. = FALSE)
browser <- login()
if (!(is.numeric(year) && nchar(year) == 4 && year >= 2002)) {
if (!(is.numeric(year) && nchar(year) == 4 && year >= 2001)) {
# Check if year is numeric, if not NULL
cli::cli_abort("Enter valid year as a number (YYYY), data only goes back to 2002")
cli::cli_abort("Enter valid year as a number (YYYY), data only goes back to 2001")
}

if (!(team %in% hoopR::teams_links$Team)) {
Expand Down Expand Up @@ -517,9 +517,9 @@ kp_gameplan <- function(team, year=2021){
expr = {
if (!has_kp_user_and_pw()) stop("This function requires a KenPom subscription e-mail and password combination,\n set as the system environment variables KP_USER and KP_PW.", "\n See ?kp_user_pw for details.", call. = FALSE)
browser <- login()
if (!(is.numeric(year) && nchar(year) == 4 && year >= 2002)) {
if (!(is.numeric(min_year) && nchar(min_year) == 4 && min_year >= 2001)) {
# Check if year is numeric, if not NULL
cli::cli_abort("Enter valid year as a number (YYYY), data only goes back to 2002")
cli::cli_abort("Enter valid min_ as a number (YYYY), data only goes back to 2001")
}

if (!(team %in% hoopR::teams_links$Team)) {
Expand Down Expand Up @@ -786,10 +786,9 @@ kp_opptracker <- function(team, year = 2021){
expr = {
if (!has_kp_user_and_pw()) stop("This function requires a KenPom subscription e-mail and password combination,\n set as the system environment variables KP_USER and KP_PW.", "\n See ?kp_user_pw for details.", call. = FALSE)
browser <- login()

if (!(is.numeric(year) && nchar(year) == 4 && year >= 2002)) {
if (!(is.numeric(min_year) && nchar(min_year) == 4 && min_year >= 2001)) {
# Check if year is numeric, if not NULL
cli::cli_abort("Enter valid year as a number (YYYY), data only goes back to 2002")
cli::cli_abort("Enter valid min_ as a number (YYYY), data only goes back to 2001")
}

if (!(team %in% hoopR::teams_links$Team)) {
Expand Down