title: Applying multiple functions using the sapply function to columns of data frame
body: <p>I have a simple and a small data set for which I wish to apply a set of functions to each column or variable of the data frame using the sapply function. Below is the code from R Blogs</p>
  
  <pre><code>multi.sapply &lt;- function(...) {
  arglist &lt;- match.call(expand.dots = FALSE)$...
  var.names &lt;- sapply(arglist, deparse)
  has.name &lt;- (names(arglist) != "")
  var.names[has.name] &lt;- names(arglist)[has.name]
  arglist &lt;- lapply(arglist, eval.parent, n = 2)
  x &lt;- arglist[[1]]
  arglist[[1]] &lt;- NULL
  result &lt;- sapply(arglist, function (FUN, x) sapply(x, FUN), x)
  colnames(result) &lt;- var.names[-1]
  return(result)
  }
  </code></pre>
  
  <p>Since I am a novice user of R, I would like to know, how can you modify the above code when the data has missing or NA values? So for example: </p>
  
  <pre><code>multi.sapply(mydata,mean, median, min, max)
  </code></pre>
  
  <p>Works fine but yields NA values for variables that has missing values</p>
  
  <p>The following code however gives me the following error message:</p>
  
  <pre><code>multi.sapply(mydata,mean, median, valid.n, min, max, na.rm = TRUE)
  </code></pre>
  
  <p>Error in get(as.character(FUN), mode = "function", envir = envir) : 
    object 'FUN' of mode 'function' was not found</p>
  
  <p>Your help would me much appreciated!   </p>