require(purrr) list <- list( node = list(a = list(y = 1, t = 1), b = list(y = 1, t = 2)), node = list(a = list(y = 1, t = 3), b = list(y = 1, t = 4))) <
require(purrr) list <- list( node = list(a = list(y = 1, t = 1), b = list(y = 1, t = 2)), node = list(a = list(y = 1, t = 3), b = list(y = 1, t = 4)))
With purrr::map
purrr::map
map(list, ~map(.x, ~.x$t))
Output is still list of list
$node $node$a [1] 1 $node$b [1] 2 $node $node$a [1] 3 $node$b [1] 4 unlist
To convert to vector
unlist(map(list, ~map(.x, ~.x$t)))
Output
node.a node.b node.a node.b 1 2 3 4