I have a script that creates a data table by inserting data row by row using a loop. The insertion is done using rbindlist()
. This method seems to be vary consuming, as it seems that in every iteration my data table dt
is reallocated:
tracemem(dt)
[1] "<0x2bd3d00>"
tracemem(dt <- rbindlist(list(dt, newrow)))
[1] "<0x44a7fe0>"
Some old comments (~3 years) in this question mention the planning of an
insert()
method, however I have not found any update in this regard. Is there any memory efficient method to do this?