When trying to create an infinite vector ( 1:Inf
) I received the following message:
Error in 1: Inf: result would be too long to vector
However, when the vector does not know in memory the message is usually different. The code below creates the three situations: a) can create the vector, b) does not fit in memory and c) "too long".
object.size(1:1e9) # limite superior do tipo a
# 4000000040 bytes
object.size(1:1e10) # limite inferior do tipo b
# Error: cannot allocate vector of size 74.5 Gb
...
object.size(1:1e15) # limite superior do tipo b
# Error: cannot allocate vector of size 7450580.6 Gb
object.size(1:1e16) # limite inferior do tipo c
# Error in 1:1e+16 : result would be too long a vector
Question: Since the two vectors (type b and type c) would not fit in memory, how does R
define it to fall into one case or the other?