Last active
March 25, 2024 14:28
-
-
Save oousmane/64c8bc6dcd11133a0af1523c1b533e3b to your computer and use it in GitHub Desktop.
utils functions for chess
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#' Title | |
#' | |
#' @param x | |
#' | |
#' @return | |
#' @export | |
#' | |
#' @examples | |
is_integer <- function(x){ | |
if (is.na(x)){ | |
is.integer(x) | |
} else if (x%%1==0){ | |
TRUE | |
} else { | |
FALSE | |
} | |
} | |
#' Title | |
#' | |
#' @param x | |
#' | |
#' @return | |
#' @export | |
#' | |
#' @examples | |
is_leap_year <- function(x) { | |
if (!is.vector(x, mode = "numeric")) { | |
rlang::abort( | |
message = "x should be a numeric vector", | |
class = "error", | |
call = caller_env() | |
) | |
} | |
lubridate::leap_year( | |
lubridate::make_date( | |
year = x | |
) | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment