I have an huge table (millions of rows and 2 columns) similar to the one below.
- FIELD1 FIELD2
- M01 ABC
- M02 ABC
- MO3 ABC
- M03 CDE
- M04 FGH
- M05 LMN
- M06 FGH
- ... ...
FIELD1 may have millions of unique values and FIELD2 may have up to 10,000 unique value. I am using the following statement in R to read the txt file and to tabulate it:
dat<-read.table(file.choose(new = FALSE), sep = "\t")
m=table(dat)
However it returns the following error
Error: cannot allocate vector of size 1.5 Gb R(390,0xac0442c0) malloc: mmap(size=1599119360) failed (error code=12) error: can't allocate region set a breakpoint in malloc_error_break to debug R(390,0xac0442c0) malloc: mmap(size=1599119360) failed (error code=12) error: can't allocate region * set a breakpoint in malloc_error_break to debug*
Any idea how to overcome this limit? Many thanks.