[R] large integers in R
Thomas Lumley
tlumley at u.washington.edu
Thu Jan 28 16:57:45 CET 2010
On Thu, 28 Jan 2010, Benilton Carvalho wrote:
> Hi Duncan,
>
> On Tue, Jan 26, 2010 at 9:09 PM, Duncan Murdoch <murdoch at stats.uwo.ca> wrote:
>> On 26/01/2010 3:25 PM, Blanford, Glenn wrote:
>>>
>>> Has there been any update on R's handling large integers greater than 10^9
>>> (between 10^9 and 4x10^9) ?
>>>
>>> as.integer() in R 2.9.2 lists this as a restriction but doesnt list the
>>> actual limit or cause, nor if anyone was looking at fixing it.
>>
>> Integers in R are 4 byte signed integers, so the upper limit is 2^31-1.
>> That's not likely to change soon.
>
> But in the hypothetical scenario that this was to change soon and we
> were to have 64bit integer type (say, when under a 64 bit OS),
> wouldn't this allow us to have objects whose length exceeded the
> 2^31-1 limit?
>
The other possibility is that an additional longer type capable of holding vector lengths would be included. In addition to the issues that Duncan mentioned, having the integer type be 64-bit means that it wouldn't match the Fortran default INTEGER type or the C int on most platforms, which are 32-bit. Calling C code would become more difficult.
-thomas
Thomas Lumley Assoc. Professor, Biostatistics
tlumley at u.washington.edu University of Washington, Seattle
More information about the R-help
mailing list