R/is_datetime.r

Defines functions is_datetime

Documented in is_datetime

#' Conditional check for a datetime variable
#'
#' @description Return TRUE if the vector is a datetime.
#'
#' @eval arg_vector("x","")
#'
#' @return A boolean vector with the return from the condition check.
#'
#' @export
#'
#' @examples
#'
#' is_datetime(Sys.time())
#'
#' is_datetime(Sys.Date())
#'

is_datetime <- function(x){

  sum(inherits(x, "POSIXct") + inherits(x, "POSIXt") + inherits(x, "POSIXlt")) > 0

}
vbfelix/relper documentation built on May 10, 2024, 10:50 p.m.