title: calculate column mean and sd when missing data is present
body: <p>I want to calculate mean and sd from  column in dataframe. This column contain NA, and Inf value.</p>
  
  <p>This is some example of value in this column</p>
  
  <pre><code>value
  
  0.9343113   
  
  0.8339523
  
  
  0.0000000
  
  
  NaN
  
  Inf
  </code></pre>
  
  <p>I try to use apply function but it give an error message</p>
  
  <pre><code>mean=apply(am_bp$foldchange_so,2,FUN=function(x){mean(x,na.rm=T)})
  </code></pre>
  
  <blockquote>
    <p>Error in apply(am_bp$foldchange_so, 2, FUN = function(x) { : 
      dim(X) must have a positive length</p>
  </blockquote>
  
  <p>Then I try <code>mean=colMeans(matrix(am_bp$foldchange_so),na.rm=TRUE)</code> but it give inf value</p>
  
  <p>Moreover, I don't know how to calculate sd in the column</p>
  
  <p>How should I solve this problem</p>