Skip to content
Prev 279678 / 398506 Next

Output table from for loop

I'd do it like this:

nums = 10:30

OutList <- vector("list", length(nums)) # The key is that you need to
return in a list: your loop iterations were all operating on the same
object OutMat and accessing different elements thereof instead of
creating new objects

for(cn in seq_along(nums)) OutList[[i]] <- Counts[Counts$var < nums[cn], ]

Michael
On Wed, Dec 7, 2011 at 10:39 AM, bmoran <bruce.moran at teagasc.ie> wrote: