creating a list of matrices in R
<p>Using a for loop, I have generated a list of matrices that are labeled X_1, X_2, X_3, ... etc.</p>

<p>I am now trying to run a series of functions on each matrix and I wrote another for loop:</p>

<pre><code>for (i in matrices) {
            df &lt;- count(i)
            df$count &lt;- df$freq
            df$freq &lt;- df$count/nrow(i)  #freq = pi in H1 equation
            for (j in names){
            assign(paste("hap",j,sep="."), df)      
            }
        }
</code></pre>

<p>I tried to generate the list of matrices using a sequence script:</p>

<pre><code>matrices &lt;- (paste("X",seq(1,nrow(windows)), sep="_"))
</code></pre>

<p>which results in the output: "X_1"  "X_2"  "X_3"  "X_4"  "X_5"
Although this is a list, it is just a list of characters and does not actually reference the matrices.  It seems to work if I manually type in the list of matrix names: </p>

<pre><code>matrices &lt;- list(X_1, X_2, X_3, X_4, X_5, ...)
</code></pre>

<p>but I was hoping to automate this so I can apply the script to large datasets.
If I try combining these with</p>

<pre><code>matrices &lt;- list(paste("X",seq(1,nrow(windows)), sep="_"))
</code></pre>

<p>I get the same thing as the first script: "X_1"  "X_2"  "X_3"  "X_4"  "X_5"</p>

<p>Is there a way to generate sequential lists of matrices so they can be used in a for loop?</p>

<p>I have also tried lapply, but I am less comfortable with this than loops and I could not get the functions I wanted to do to work in lapply.</p>