It is inefficient in R to expand a data structure in a loop. How do I preallocate a list of a certain size? matrix makes this easy via the n
list
matrix
n
vector can create empty vector of the desired mode and length.
vector
x <- vector(mode = "list", length = 10)