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 Sept. 30, 2024, 9:19 a.m.