title: Storing the simulated data set using list() function in R
body: <p>I am using the following <code>r</code> code to simulate <code>normal</code> data set. I have copied them below.</p>
  
  <pre><code>set.seed(1234)
  ml = matrix(c(4,2,3,5,6,8,1,4,3), nrow = 3, ncol = 3)
  ml #left side of parameter
       [,1] [,2] [,3]
  [1,]    4    5    1
  [2,]    2    6    4
  [3,]    3    8    3
  mr = matrix(c(6,4,5,2,8,7,6,9,4), nrow = 3, ncol = 3)
  mr #right side of parameter
       [,1] [,2] [,3]
  [1,]    6    2    6
  [2,]    4    8    9
  [3,]    5    7    4
  
  n = nrow(ml)
  
  set.seed(1234)
  y.all = list()
  for(j in 1:ncol(ml)){
     for (i in 1:(n - 1)){
        y.all[[i]] = c(rnorm(i, ml[i, j], 1), rnorm((n - i), mr[i,j], 1))
      }
    }
  
  sim.data = matrix(unlist(y.all), ncol(ml)*(ncol(ml) - 1)*ncol(ml), 1, byrow = TRUE)
  sim.data = matrix(sim.data, nrow = ncol(ml), ncol = nrow(sim.data)/nrow(ml))
  dim(sim.data)
  [1] 3 6
  sim.data
            [,1]     [,2]      [,3]     [,4]      [,5]     [,6]
  [1,] 0.2237461 3.889715 0.2237461 3.889715 0.2237461 3.889715
  [2,] 6.0644588 3.488990 6.0644588 3.488990 6.0644588 3.488990
  [3,] 6.9594941 8.088805 6.9594941 8.088805 6.9594941 8.088805
  </code></pre>
  
  <p>I used the above code simulate the above <code>3X6</code> matrix data set. The first <code>2 columns</code> of <code>sim.data</code> created using the <code>1st column</code> of <code>ml</code> and <code>1st column</code> of <code>mr</code> and so on.</p>
  
  <p>However, I checked them individually in the following way. Unfortunately , they are not same. </p>
  
  <pre><code>set.seed(1234)
  j = 1
  i = 1
  c(rnorm(i, ml[i, j], 1), rnorm((n - i), mr[i,j], 1))
  [1] 2.792934 6.277429 7.084441
  i = 2
  c(rnorm(i, ml[i, j], 1), rnorm((n - i), mr[i,j], 1))
  [1] -0.3456977  2.4291247  4.5060559
  i = 3
  c(rnorm(i, ml[i, j], 1), rnorm((n - i), mr[i,j], 1))
  [1] 2.425260 2.453368 2.435548
  set.seed(1234)
  j = 2
  i = 1
  c(rnorm(i, ml[i, j], 1), rnorm((n - i), mr[i,j], 1))
  [1] 3.792934 2.277429 3.084441
  i = 2
  c(rnorm(i, ml[i, j], 1), rnorm((n - i), mr[i,j], 1))
  [1] 3.654302 6.429125 8.506056
  i = 3
  c(rnorm(i, ml[i, j], 1), rnorm((n - i), mr[i,j], 1))
  [1] 7.425260 7.453368 7.435548
  set.seed(1234)
  j = 3
  i = 1
  c(rnorm(i, ml[i, j], 1), rnorm((n - i), mr[i,j], 1))
  [1] -0.2070657  6.2774292  7.0844412
  i = 2
  c(rnorm(i, ml[i, j], 1), rnorm((n - i), mr[i,j], 1))
  [1] 1.654302 4.429125 9.506056
  i = 3
  c(rnorm(i, ml[i, j], 1), rnorm((n - i), mr[i,j], 1))
  [1] 2.425260 2.453368 2.435548
  </code></pre>
  
  <p>Am I making any mistake in the above <code>r</code> code? Are there any way to simulate the data set?</p>
  
  <p>Thank you in advance. </p>