Skip to content

Instantly share code, notes, and snippets.

@oousmane
Last active March 25, 2024 14:28
Show Gist options
  • Save oousmane/64c8bc6dcd11133a0af1523c1b533e3b to your computer and use it in GitHub Desktop.
Save oousmane/64c8bc6dcd11133a0af1523c1b533e3b to your computer and use it in GitHub Desktop.
utils functions for chess
#' 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