1
的样本数据:第N个列表条目ID
l <- list(NULL, NULL, NULL, NULL, data.frame(x=1,z=5))
我已经在其他尝试:
lapply(1:length(l), function(i) l$id <- i)
期望的结果:
l
[[1]]
NULL
[[2]]
NULL
[[3]]
NULL
[[4]]
NULL
[[5]]
id x z
1 5 1 5
!今天只是简单的问题:)。谢谢。 – Maximilian
你太快了我的朋友 –
@RichardScriven我早些时候在想索引方法,但是当OP使用它时,我发布了'lapply'。 – akrun