format.Date: Alternative for format.Date

Description Usage Arguments

Description

On the R-devel mailinglist, it was noted that as.Date(Inf, origin='1970-01-01') is stored as a valid Date-object, and is.na() returns FALSE, but when printing this object it shows 'NA", which is confusing. It turns out this is because when formatting a Date-object it is converted to a POSIXlt-object, which fails for Inf, as well as other out-of-range values. Therefore this function defaults to a numerical value if the date is outside the range 1-1-1 up till 9999-12-31, with a warning

Usage

1
2
## S3 method for class 'Date'
format(x, ...)

Arguments

x

Date to format

...

Other arguments passed on to format.POSIXlt


EmilBode/EmilMisc documentation built on Feb. 24, 2020, 4:11 p.m.