R/as.Date.R

Defines functions .as_Date_default

as.Date <- function (x, ...) {
  ## for plain numeric input, call zoo:::as.Date.numeric
  if (!is.object(x) && is.numeric(x)) as.Date.numeric(x, ...)
  else UseMethod("as.Date")
}

as.Date.numeric <- function (x, origin, ...) {
  if (missing(origin)) origin <- "1970-01-01"
  if (identical(origin, "0000-00-00")) origin <- as.Date("0000-01-01", ...) - 1
  as.Date(origin, ...) + x
}

.as_Date_default <- function(x, ...) base::as.Date(x, ...)

Try the zoo package in your browser

Any scripts or data that you put into this service are public.

zoo documentation built on April 14, 2023, 12:39 a.m.