title: Normalize Function Returning NaN
body: <p>I am trying to use lapply apply to apply this function to a vector but it just returns NaN.</p>
  
  <pre><code>normalize&lt;-function(object){ return((object-min(object))/(max(object)-min(object))) } 
  
  x&lt;-c(1,5,10)
  lapply(x,normalize)
  [[1]]
  [1] NaN
  
  [[2]]
  [1] NaN
  
  [[3]]
  [1] NaN
  </code></pre>
  
  <p>It works fine when I use normalize(c(1,5,10)). </p>