[Rd] R limits documented?

Prof Brian Ripley ripley at stats.ox.ac.uk
Sat Feb 12 18:12:47 CET 2011


On Sat, 12 Feb 2011, Uwe Ligges wrote:

> I think it is easiest to point people to the manual "R Internals" for 
> questions on the size of integers, pointers etc.

But ?"Memory-limits" is a good start.

The messages below (which were not from a current version of R with 
that call!) come from

> as.integer(50000 * 50000)
[1] NA
Warning message:
NAs introduced by coercion

and times = NA is of course invalid.

>
> Best,
> Uwe Ligges
>
>
>
> On 12.02.2011 03:24, David Winsemius wrote:
>> 
>> On Feb 11, 2011, at 8:46 PM, Simon Urbanek wrote:
>> 
>>> 
>>> On Feb 11, 2011, at 8:45 PM, Simon Urbanek wrote:
>>> 
>>>> 
>>>> On Feb 11, 2011, at 7:55 PM, David Winsemius wrote:
>>>> 
>>>>> 
>>>>> On Feb 11, 2011, at 7:09 PM, Dominick Samperi wrote:
>>>>> 
>>>>>> Is there documentation on R limits?
>>>>>> That is, max matrix size, etc.?
>>>>>> 
>>>>>> Diagnostics when limits are exceeded are not always
>>>>>> meaningful. For example:
>>>>>>> x <- rep(0,50000*50000)
>>>>>> Error in rep(0, 50000 * 50000) : invalid 'times' argument
>>>>>> In addition: Warning message:
>>>>>> In as.vector(data) : NAs introduced by coercion
>>>>> 
>>>>>> x <- rep(0,40000*50000)
>>>>>> gc()
>>>>> used (Mb) gc trigger (Mb) max used (Mb)
>>>>> Ncells 4673306 249.6 6945861 371.0 5315868 283.9
>>>>> Vcells 2165579376 16522.1 4374103452 33371.8 4165580443 31780.9
>>>>>> object.size(x)
>>>>> 16000000040 bytes
>>>>> 
>>>>> So that is about 2/3 of my installed memory. This seems to be a
>>>>> limitation due to the maximum positive integer being ~ 2*10^9
>>>>>> 2*10^9 < 50000*50000
>>>>> [1] TRUE
>>>>>> 2*10^9 < 40000*50000
>>>>> [1] FALSE
>>>>> 
>>>> 
>>>> The actual limit is for obvious reasons 2^31-1
>>>> 
>>>>> as.integer(2^31-1)
>>>> [1] 2147483647
>>>>> as.integer(2^31)
>>>> [1] NA
>>>> Warning message:
>>>> NAs introduced by coercion
>>>> 
>>>> (ok, for those that this is not obvious: the integer type ("int" in
>>>> C) is 32-bit wide and it is a signed type so the range is -2^31-1 ..
>>>> 2^31-1 -- the minus one on each side is the representation of NA and
>>>> 0 respectively).
>>>> 
>>> 
>>> correction: the range should have read -(2^31-1) .. 2^31
>> 
>> I was using the number given in the help page documentation for
>> "integer". (Part of the question was whether it was "documented".) I did
>> understand that it was d/t the 4 byte range.
>> 
>> Regarding the second part of the OP's question.... this is from the
>> "character" help page:
>> "as.character truncates components of language objects to 500 characters
>> (was about 70 before 1.3.1)."
>> 
>> And there was a posting from Prof Ripley regarding some other
>> limitations that had been recently modified:
>> https://stat.ethz.ch/pipermail/r-devel/2010-November/058989.html
>> 
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-devel mailing list