foreach
foreach copied to clipboard
Keep names in the output list
This is a feature request. It would be really nice to keep the names of the iterated list in the results. Here's an example.
xList <- list(a = 1, b = 2)
foreach(x = xList) %do% x^2
returns
[[1]]
[1] 1
[[2]]
[1] 4
but a named list similar to that returned by lapply()
would be useful:
$a
[1] 1
$b
[1] 4