From hpages at fhcrc.org  Tue Oct 27 21:25:38 2009
From: hpages at fhcrc.org (=?ISO-8859-1?Q?Herv=E9_Pag=E8s?=)
Date: Tue, 27 Oct 2009 13:25:38 -0700
Subject: [Rd] inaccurate integer conversion in coercion
Message-ID: <4AE75742.4070903@fhcrc.org>

Hi,

 > as.integer(10000000000)  # 10 billions
[1] NA
Warning message:
NAs introduced by coercion

 > as.integer(-10000000000)  # minus 10 billions
[1] NA
Warning message:
NAs introduced by coercion

 > as.integer("10000000000")  # 10 billions as a string
[1] 2147483647
Warning message:
inaccurate integer conversion in coercion

 > as.integer("-10000000000")  # minus 10 billions as a string
[1] NA
Warning message:
inaccurate integer conversion in coercion

Why is the "10 billions as a string" case treated differently?
(coerced to INT_MAX-1)

And for the "minus 10 billions as a string" case, is the warning
message really appropriate? Why isn't it just the usual "NAs
introduced by coercion"?

Thanks,
H.



[Rd] inaccurate integer conversion in coercion
=?ISO-8859-1?Q?Herv=E9_Pag=E8s?=