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.

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to