title: R: Applying function to DataFrame
body: <p>I have following code:</p>
  
  <pre><code>library(Ecdat)
  data(Fair)
  Fair[1:5,]
  
  x1 = function(x){
    mu = mean(x)
    l1 = list(s1=table(x),std=sd(x))
    return(list(l1,mu))
  }
  
  mylist &lt;- as.list(Fair$occupation,
                 Fair$education)
  
  x1(mylist)
  </code></pre>
  
  <p>What I wanted is that x1 outputs the result for the items selected in mylist. However, I get <code>In mean.default(x) : argument is not numeric or logical: returning NA</code>.</p>