preallocate list in R

前端 未结 3 943
渐次进展
渐次进展 2020-12-04 23:45

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

3条回答
  •  攒了一身酷
    2020-12-05 00:04

    vector can create empty vector of the desired mode and length.

    x <- vector(mode = "list", length = 10)
    

提交回复
热议问题