[R] Integers in S-Plus and R
Spencer Graves
spencer.graves at pdf.com
Mon Sep 15 02:25:42 CEST 2003
I wish to comment on interesting and inconsistent behavior of both
S-Plus and R with integers.
In R 1.7.1 for Windows, is.integer(2) is FALSE, though
is.integer(1:2) and is.integer(max(1:2)) are both TRUE. S-Plus 6.1
produces TRUE for all three cases.
Meanwhile, as.integer(1e111) produces NA in R 1.7.1 and 2147483647 in
S-Plus 6.1. This behavior is consistent with the documentation in both
cases: R says, "The answer will be `NA' unless the coercion succeeds."
S-Plus says, "The numbers are truncated (moved to the closest integer
...)."
Just one more thing to consider when trying to produce transportable
scripts.
Spencer Graves
More information about the R-help
mailing list