Reputation: 796
When you have a x<-list()
file in a loop, as function progress, its size increases and therefore memory allocation also increases. After a while you may encounter with memory error
. How is it possible to guess max needed memory and also dedicate it from the beginning?
Can making a pre-defined size make sense? Or is there a better method for this?
Regards.
Upvotes: 0
Views: 72
Reputation: 1464
Something like this
x <- vector('list', 10)
since vector
can create empty vector of the desired mode and length.
Answer taken from earlier SO question
Upvotes: 1