title: R: Statistics of distribution
body: <p>I have the number of samples per unit and need to calculate statistics with R.</p>
  
  <p>The table is like this (all rows and columns are actually filled with values, I only write a few here for easier visibility, and there are many more columns):</p>
  
  <pre>
  Hour     1    2    3    4
  
  H1       72  11   98   65
  
  H2       19  27
  
  H3
  
  H4
  
  H5
  
  :
  
  H200000
  </pre>
  
  <p>I.e. the first hour (H1) there were 72 samples of value 1, 11 samples of value 2, etc. The second hour(H2) there were 19 samples of value 1, 27 samples of value 2, etc.</p>
  
  <p>I need to calculate the mean and standard deviation per hour (i.e. per row). As there are many thousands of rows I need a fast method.</p>
  
  <p>Example: The manual mean-calculation for hour 1 (H1) would be: </p>
  
  <pre>
  (72x1 + 11x2 + 98x3 + 65x4)/(72+11+98+65) = 2.6
  </pre>
  
  <p>I suppose there are R-methods or packages that can do this, but I fail to find where. Your support is highly appreciated.</p>
  
  <p>Thanks,
  Chris</p>