[R] Error: cannot allocate vector of size...

tlumley at u.washington.edu tlumley at u.washington.edu
Wed Nov 11 21:41:51 CET 2009


On Wed, 11 Nov 2009, Larry Hotchkiss wrote:

> Hi,
>
> I'm responding to the question about storage error, trying to read a 3000000 x 100 dataset into a data.frame.
>
> I wonder whether you can read the data as strings. If the numbers are all one digit, each cell would require just 1 byte instead of 8.

Um, no.

>  a<-rep("1",100000)
> object.size(a)
400056 bytes
> object.size(a)/length(a)
4.00056 bytes

They are character strings, not individual characters, so some overhead is unavoidable.  Even if all the strings are identical you need four bytes per string, the same as if the data were read as integers.

      -thomas

Thomas Lumley			Assoc. Professor, Biostatistics
tlumley at u.washington.edu	University of Washington, Seattle




More information about the R-help mailing list