title: Dplyr filter using dynamic column name and value
body: <p>I'm trying to filter my data frame using a variable as the column name and another variable as the filter value. I've used filter_ in the past but where only the value i'm looking to filter was variable.</p>
  
  <p>Here's some example code</p>
  
  <pre><code>#Create data frame
  Code &lt;- c("A12561", "B12817")
  Value &lt;- c(100,200)
  
  df &lt;- data.frame(Code, Value)
  
  
  #Normal filter - WORKS
  filter(df, Code == "A12561")
  
  
  
  #Variable for column and value
  Col.Var &lt;- "Code"
  Test.Val &lt;- "A12561"
  
  #Filter with only the number coming from a variable - WORKS
  filter_(df, ~Code == Test.Val)
  #Filter_ Returns nothing - DOESN'T WORK
  filter_(df, Col.Var == Test.Val)
  #Pasting a string - returns an error - DOESN'T WORK
  filter_(df, paste(Col.Var, "==", Test.Val))
  </code></pre>