更新时间:2022-05-27 22:09:21
一种选择是先unlist
列表x
,然后替换名为的值"a"
,然后根据x
的列表结构relist
新列表u
.
One option would be to first unlist
the list x
, then replace the values named "a"
, and then relist
the new list u
based on the list structure of x
.
u <- unlist(x)
u[names(u) == "a"] <- 10:12
relist(u, x)