title: How to find the mean of non-zero values by group?
body: <p>I want to find the mean of non-zero values by group for multiple columns:</p>
  
  <pre><code>mydata&lt;- data[, lapply(.SD, function(x) mean(x, na.rm=TRUE)), by=group, 
                          .SDcols=c("col1", "col2")]
  </code></pre>
  
  <p>What should I add to the above code?</p>