 <p>This is a great use case for either <code>by</code> or <code>lapply</code> rather than a <code>for</code>-loop. Basically, the result is the same, but without the overhead of writing a loop, iterating over it, and storing the results appropriate. Here's a simple example like yours that uses the built-in <code>mtcars</code> dataset:</p> <pre><code>b &lt;- by(mtcars, mtcars$gear, FUN = function(d) xtabs(~cyl + vs + am, data = d)) l &lt;- lapply(split(mtcars, mtcars$gear), FUN = function(d) xtabs(~cyl + vs + am, data = d)) </code></pre> <p>We can use <code>str</code> to take a look at what we created:</p> <pre><code>&gt; str(b, 1) List of 3 $ 3: xtabs [1:3, 1:2, 1] 0 0 12 1 2 0 ..- attr(*, "dimnames")=List of 3 ..- attr(*, "class")= chr [1:2] "xtabs" "table" ..- attr(*, "call")= language xtabs(formula = ~cyl + vs + am, data = d) $ 4: xtabs [1:2, 1:2, 1:2] 0 0 2 2 0 2 6 0 ..- attr(*, "dimnames")=List of 3 ..- attr(*, "class")= chr [1:2] "xtabs" "table" ..- attr(*, "call")= language xtabs(formula = ~cyl + vs + am, data = d) $ 5: xtabs [1:3, 1:2, 1] 1 1 2 1 0 0 ..- attr(*, "dimnames")=List of 3 ..- attr(*, "class")= chr [1:2] "xtabs" "table" ..- attr(*, "call")= language xtabs(formula = ~cyl + vs + am, data = d) - attr(*, "dim")= int 3 - attr(*, "dimnames")=List of 1 - attr(*, "call")= language by.data.frame(data = mtcars, INDICES = mtcars$gear, FUN = function(d) xtabs(~cyl + vs + am, data = d)) - attr(*, "class")= chr "by" &gt; str(l, 1) List of 3 $ 3: xtabs [1:3, 1:2, 1] 0 0 12 1 2 0 ..- attr(*, "dimnames")=List of 3 ..- attr(*, "class")= chr [1:2] "xtabs" "table" ..- attr(*, "call")= language xtabs(formula = ~cyl + vs + am, data = d) $ 4: xtabs [1:2, 1:2, 1:2] 0 0 2 2 0 2 6 0 ..- attr(*, "dimnames")=List of 3 ..- attr(*, "class")= chr [1:2] "xtabs" "table" ..- attr(*, "call")= language xtabs(formula = ~cyl + vs + am, data = d) $ 5: xtabs [1:3, 1:2, 1] 1 1 2 1 0 0 ..- attr(*, "dimnames")=List of 3 ..- attr(*, "class")= chr [1:2] "xtabs" "table" ..- attr(*, "call")= language xtabs(formula = ~cyl + vs + am, data = d) </code></pre> <p>In this case, I think the result from <code>lapply</code> is probably closer to what you're going for, but (as you can hopefully see) the structures are very similar - both are lists of <code>xtabs</code> objects.</p>