[Rd] NAs and Infinitely Large POSIXct Objects

McGehee, Robert Robert.McGehee at geodecapital.com
Mon Apr 14 21:15:16 CEST 2008

I got bungled up by the fact that an infinite POSIXct object is
represented by NA, but is not, in fact, NA. While an infinitely large
POSIXct object seems strange, perhaps R should use the convention of
representing it as Inf rather than NA to avoid any confusion.


> x <- as.POSIXct(NA)
> z <- min(x, x, na.rm=TRUE)
Warning message:
In min.default(NA_real_, NA_real_, na.rm = TRUE) :
  no non-missing arguments to min; returning Inf
> z
[1] NA
> is.na(z)
> is.infinite(z)
[1] TRUE

> R.version
platform       i686-pc-linux-gnu
arch           i686
os             linux-gnu
system         i686, linux-gnu
major          2
minor          6.2
year           2008
month          02
day            08
svn rev        44383
language       R
version.string R version 2.6.2 (2008-02-08)

Robert McGehee, CFA
Geode Capital Management, LLC
One Post Office Square, 28th Floor | Boston, MA | 02109
Tel: 617/392-8396    Fax:617/476-6389
mailto:robert.mcgehee at geodecapital.com

This e-mail, and any attachments hereto, are intended fo...{{dropped:11}}

More information about the R-devel mailing list