User Tools

Site Tools


mean_without_zeros

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

mean_without_zeros [2015/12/16 13:26] (current)
vincenzo created
Line 1: Line 1:
 +<code c> 
 +nzmean <- function(x) { 
 +  zvals <- x==0 
 +  if (all(zvals)) 0 else mean(x[!zvals]) 
 +
 +</​code>​
mean_without_zeros.txt · Last modified: 2015/12/16 13:26 by vincenzo