title: Using for () loop or apply () to bootstrap means in a matrix
body: <p>I have the following matrix (let's call it df), for which I would like to create bootstrapped means and 95% confidence intervals for each column, due to the heavily 0 weighted distribution.  I would like the mean and CI's to be added to the bottom of the matrix as new rows.    This is a small subset of the data, the true data has >600 rows which will make the bootstrapping much more effective.</p>
  
  <pre><code>row.names   V183    V184    V185    V186    V187    V188    V189    V190    V191    V192    V193    V194    V195    V196    V197    V198    V199    V200    V201    V202    V203    V204    V205
  1   0.07142857  0.07142857  0.07142857  0.07142857  0.07142857  0.07142857  0.07142857  0.07142857  0.07692308  0.07692308  0.07692308  0.07692308  0.07692308  0.07692308  0.07692308  0.07692308  0.07692308  0.07692308  0.07692308  0.07692308  0.07692308  NA  NA
  2   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
  3   0.022   0.022   0.022   0.022   0.022   0.022   0.022   0.022   0.022   0.022   0.022   0.022   0.022   0.022   0.022   0.022   0   NA  NA  NA  NA  NA  NA
  4   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0.07692308  0.07692308  0.07692308  0.07692308  0.07692308  0.07692308  0.07692308  0.07692308
  5   0   0   0   0   0.066   0.066   0.066   0.066   0.066   0.066   0.066   0.066   0.066   0.066   0   0   0   0   0   0   0   0   0
  6   0.077   0.077   0.077   0.077   0.077   0.077   0.077   0.077   0.077   0.077   0.077   0.077   0.077   0.077   0.077   0.077   0.077   0.077   0.077   0   0   0   0
  7   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
  8   0.07142857  0.07142857  0.07142857  0.07142857  0.07142857  0.07142857  0.07142857  0.07142857  0.07142857  0.07142857  0.07142857  0   0   0   0   0   0   0   0   0   0   0   0
  9   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   NA  NA  NA  NA  NA  NA
  10  0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
  11  NA  NA  NA  NA  NA  NA  NA  NA  NA  NA  NA  NA  0.03225806  0.03225806  0.03225806  0.03225806  0.03225806  0.03225806  0.03225806  0.03225806  0.03225806  0.03225806  0.03225806
  12  0   0   0   0   0   0   0   0   0   0   0   0   0   NA  NA  NA  NA  NA  NA  NA  NA  NA  NA
  13  0   0   0   0   0   0   0   0   0   NA  NA  NA  NA  NA  NA  NA  NA  NA  NA  NA  NA  NA  NA
  14  0   0   0.033   0.033   0.033   0.033   0.033   0.033   0.033   0.033   0.033   0.033   0.033   0.033   0.033   0.033   0.033   0   0   0   0   0   0
  </code></pre>
  
  <p>I have had success creating bootstrapped values for a single column, but have not been successful creating a for () loop that will populate an entire row of bootstrapped values for the matrix</p>
  
  <p>The following is my code for a single row.</p>
  
  <pre><code>dfsub&lt;-df[,1]
  mean.boot &lt;- function(dfsub, d) {
  E=dfsub[d,]
  return(mean(E, na.rm=T))}
  b = boot(dfsub, mean.boot, R=1000)
  b
  </code></pre>
  
  <p>Any thoughts?  Would a for loop or an apply fn work better?</p>
  
  <p>Also, the output for the booted values gives an original value and a bias, but where is the actual bootstrapped mean?</p>