title: How to make this select function work in R?
body: <p>I'm trying to create a function to extract certain columns from a data set. I tried this:</p>
  
  <pre><code>extract &lt;- function(x) {
   x &lt;- select(filter(df),c(id,x))
  }  
  
  extract(df$var1)
  </code></pre>
  
  <p>in which <code>id</code> is an identification variable. But there's an error message saying:</p>
  
  <blockquote>
    <p>Error: c(id, x) must evaluate to column positions or names, not a double vector</p>
  </blockquote>
  
  <p>How can I fix this?</p>