Dear R Community,

I have the following Problem. I use foreach nested loops, which then return
a list of lists. E.g.:

[[1]]
[[1]][[1]]
Output
[[1]][[2]]
Output
[[1]][[3]]
Output
[[2]]
[[2]][[1]]
Output
....

What I want to achieve is a single layer list, i.e. a list in which
[[1]][[1]] becomes [[1]], [[1]][[2]] becomes [[2]],...,[[2]][[1]] becomes
[[4]] and so on.

Here a reproducible example:

test <- foreach(i = 1:3) %:%
              foreach (j = 1:3) %do% {
                 paste(i,j,sep=",")
              }

In my real problem I have up to 5-6 layers. Anyone an idea?

Thanks!

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to