【发布时间】:2021-05-04 17:24:54
【问题描述】:
这是一个代码(另见代码中的 cmets):
library(rlist)
lwa_res_lst <- vector(mode = "list", length = 1) # Create empty list. Unfortunatly with this method I cannot create list with 0 length.
current_res <- 1
lwa_res_lst <- list.append(lwa_res_lst, current_res) # Append the element at the end of the list.
我的问题是:如何最初创建一个空列表,然后可以在位置1 处附加一个带有list.append() 的元素?
【问题讨论】:
-
这个函数只是
c:c(list(), 1)或c(NULL, list(1))会给你一样的