R Tip: Use vector(mode = "list") to Pre-Allocate Lists

Win-Vector Blog 2018-03-06

Summary:

Another R tip. Use vector(mode = "list") to pre-allocate lists. result <- vector(mode = "list", 3) print(result) #> [[1]] #> NULL #> #> [[2]] #> NULL #> #> [[3]] #> NULL The above used to be critical for writing performant R code (R seems to have greatly improved incremental list growth over the years). It … Continue reading R Tip: Use vector(mode = "list") to Pre-Allocate Lists

Link:

http://www.win-vector.com/blog/2018/03/r-tip-use-vectormode-list-to-pre-allocate-lists/

From feeds:

Statistics and Visualization » Win-Vector Blog

Tags:

Authors:

John Mount

Date tagged:

03/06/2018, 16:06

Date published:

03/06/2018, 09:49