更新时间:2022-11-22 11:59:02
如果您知道要从哪个级别提取信息,您可以使用 modify_depth
来解决这个问题.
You can use modify_depth
for this if you know what level you want to pull the information out of.
您想为嵌套列表提取 t
,这是级别 2.
You want to pull t
out for the nested lists, which is level 2.
modify_depth(list, 2, "t")
$node
$node$a
[1] 1
$node$b
[1] 2
$node
$node$a
[1] 3
$node$b
[1] 4
purrr modify
函数系列返回与输入类型相同的对象,因此您需要 unlist
以获取一个向量而不是一个列表.
The purrr modify
family of functions returns an object of the same type as the input, so you'd need to unlist
to get a vector instead of a list.