Learn R Programming

Ecfun (version 0.2-0)

as.Date1970: Date from a number of days since the start of 1970.

Description

as.Date.numeric requires orgin to be specified. The present function assumes that this origin is January 1, 1970.

Usage

as.Date1970(x, ...)

Arguments

x

a numeric vector of dates in days since the start of 1970.

optional arguments to pass to as.Date.

Value

Returns a vector of Dates

See Also

as.Date as.POSIXct1970

Examples

Run this code
# NOT RUN {
days <- c(0, 1, 365)
Dates <- as.Date1970(days)

# }
# NOT RUN {
all.equal(c('1970-01-01', '1970-01-02', '1971-01-01'),
          as.character(Dates))
# }
# NOT RUN {
# }
# NOT RUN {
all.equal(days, as.numeric(Dates))
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab