title: how to save index of variable in matrix to count the number of occurrences
body: <pre><code>    for (i in 1:10){
  
        z1&lt;-rnorm(1000,0,1)
        z2&lt;-rnorm(1000,0,1)
        z3&lt;-rnorm(1000,0,1)
        z4&lt;-rnorm(1000,0,1)
        z5&lt;-rnorm(1000,0,1)
        z6&lt;-rnorm(1000,0,1)
        z7&lt;-rnorm(1000,0,1)
  
        X&lt;-cbind(z1,z2,z3,z4,z5,z6)
  
        Z&lt;-apply(X,2,mean)
         test[i]&lt;-which(Z&gt;0.01, arr.ind=TRUE)
  
      }
  </code></pre>
  
  <p>I am interested here to save the index of Z under condition in another variable to count at end how many indices were full filling the condition.</p>
  
  <p>For example 
  Let first output was
  3 4 
  second output
  6
  third
  1 2 3 5 </p>
  
  <p>now i want to compute that output these 3 outputs how many ones, twos, threes etc were appeared.</p>
  
  <p>Here in all these 3 outputs
  1 appeared 1 time
  2 appeared 1 time
  3 appeared 2 times 
  4 appeared 1 time
  5 appeared 1 time
  6 appeared 1 time.</p>
  
  <p>Thanks in advance</p>