R/as.POSIXct1970.R

Defines functions as.POSIXct1970

Documented in as.POSIXct1970

as.POSIXct1970 <- function(x, tz="GMT", ...){
#
  if(!is.numeric(x)){
    Px <- try(as.POSIXct(x, tz=tz, ...))
    if(inherits(Px,'try-error')){
      nx <- length(x)
      Px <- rep(as.POSIXct1970(0), nx)
    }
    return(Px)
  }
#
  o1970 <- strptime('1970-01-01', '%Y-%m-%d', tz=tz)
  o1970. <- as.POSIXct(o1970, tz=tz)
#
  as.POSIXct(x, tz=tz, origin=o1970., ...)
}

Try the fda package in your browser

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

fda documentation built on May 31, 2023, 9:19 p.m.