title: How to pass an R function argument to select rows from a df
body: <p>I'm trying to write a function that will allow me to specify one or more values in column "x" of my df so that my result contains only the rows with those x values. I plan to add other arguments to the function later, but this is a first step. </p>
  
  <pre><code>x&lt;-c(1:100)
  y&lt;-rnorm(100)
  df&lt;-as.data.frame(cbind(x,y))
  myfunc&lt;-function(x=1:100){
  result&lt;-subset(df,select=x)
  result
  }
  </code></pre>
  
  <p>When I run the following code to obtain a 4-row df, the result is 100 rows and only column x:</p>
  
  <pre><code>&gt; myfunc(x==3:6)
        x
  1     1
  2     2
  3     3
  4     4
  5     5
  ....
  99   99
  100 100
  </code></pre>
  
  <p>myfunc(x=3:6) and myfunc(3:6) don't work either</p>