I am trying to read a large matrix into R. The matrix has dimensionality: 3'987'288 x 93 and is about 3GB large. (Class = double) It is saved as a .mat file (it is not a v7.3 .mat file)
I tried to read the matrix with the R.matlab package:
require(R.matlab)
A <- readMat('dat_2imp.mat')
However, it results into this error:
Error in seq.int(from = rawBufferOffset + 1L, to = rawBufferOffset + nbrOfBytes, :
wrong sign in 'by' argument
I did not find valuable information on this error message. However, I assume it might be due to the large size of the matrix. Do somebody know how to tackle this problem? Sadly I am not allowed to share the original data and make it fully reproducible.
The error should be raised from the function in line 88 in the code of readMat:
# Access source code:
View(R.matlab:::readMat.default)
# In line 88 defined function:
readRawBuffer <- function(nbrOfBytes) {
nTotal <- length(rawBuffer)
if (nTotal == 0L) {
return(raw(0L))
}
idxs <- seq.int(from = rawBufferOffset + 1L, to = rawBufferOffset +
nbrOfBytes, by = 1L)
rawBuffer[idxs]
}
For me the defined "by" is legit and therefore the error does not make sense to me?