title: replicate function in R returns NULL
body: <p>I am confused about the output from the replicate function in R, I am trying to use it in two different ways, that (in my mind) should give a matrix as output!</p>
  
  <p>so, if I use</p>
  
  <pre><code>replicate(5, seq(1,5,1))
  </code></pre>
  
  <p>I get a matrix 5x5 </p>
  
  <pre><code>    [,1] [,2] [,3] [,4] [,5]
  [1,]    1    1    1    1    1
  [2,]    2    2    2    2    2
  [3,]    3    3    3    3    3
  [4,]    4    4    4    4    4
  [5,]    5    5    5    5    5
  </code></pre>
  
  <p>..and that's ok, I get that...</p>
  
  <p>but, if I instead use:</p>
  
  <pre><code>replicate(5, for(i in 1:5){print(i)})
  </code></pre>
  
  <p>I get the following:</p>
  
  <pre><code>[1] 1
  [1] 2
  [1] 3
  [1] 4
  [1] 5
  [1] 1
  [1] 2
  [1] 3
  [1] 4
  [1] 5
  [1] 1
  [1] 2
  [1] 3
  [1] 4
  [1] 5
  [1] 1
  [1] 2
  [1] 3
  [1] 4
  [1] 5
  [1] 1
  [1] 2
  [1] 3
  [1] 4
  [1] 5
  [[1]]
  NULL
  
  [[2]]
  NULL
  
  [[3]]
  NULL
  
  [[4]]
  NULL
  
  [[5]]
  NULL
  </code></pre>
  
  <p>can anyone explain me why does this happen?
  thanks :)</p>