I have a big multidimensional array and I want it to occupy as little memory as possible. In python, this occupies 66 Mb.
m = np.zeros([1000, 70, 1, 1000], dtype='bool')
size = sys.getsizeof(m)/1024/1024
print("Size: %s MB" % size)
However, in R, the same array occupies 4 times more memory (267Mb).
m <- array(FALSE, dim = c(1000, 70, 1, 1000))
format(object.size(m), units = "auto")
Any idea on how to reduce the array size in R?
EDIT:
This array will be used as the X input in an external API. This function takes as argument an array or an internal iterator called mx.io.arrayiter
.