Вопрос по r – Максимальная длина для вектора в R


Согласно R '' ограничениям памяти '' документация, невозможно выделить вектор длиной более 2 ^ 31-1. Это связано с тем, что целое число, используемое в качестве индекса, может использовать только 31 бит (один бит для знака). Но в 64-битной системе я должен иметь возможность выделять более длинные векторы. Почему R накладывает такую же максимальную длину на 64-битные системы? Есть ли способ обойти ограничение?

Error: User Rate Limit Exceeded Joshua Ulrich

Ваш Ответ

2   ответа

experimental :


There are the beginnings of support for vectors longer than 2^31 - 1 elements on 64-bit platforms. This applies to raw, logical, integer, double, complex and character vectors, as well as lists. (Elements of character vectors remain limited to 2^31 - 1 bytes.)

All aspects are currently experimental.

What can be done with such vectors is currently somewhat limited, and most operations will return the error ‘long vectors not supported yet’. They can be serialized and unserialized, coercion, identical() and object.size() work and means can be computed. Their lengths can be get and set by xlength(): calling length() on a long vector will throw an error.

Most aspects of indexing are available. Generally double-valued indices can be used to access elements beyond 2^31 - 1.

Error: User Rate Limit Exceededthis postError: User Rate Limit Exceeded


Even on 64-bit builds of R there are limits on the size of R objects (see help("Memory-limits"), some of which stem from the use of 32-bit integers (especially in FORTRAN code). On all builds of R, the maximum length (number of elements) of a vector is 2^31-1, about 2 billion, and on 64-bit builds the size of a block of memory allocated is limited to 2^34-1 bytes (8GB). It is anticipated these will be raised eventually* but the need for 8GB objects is (when this was written in 2011) exceptional.


Похожие вопросы