0

I am trying to pass in a column name to the dplyr filter function, but I can't seem to get it to work. I always return all of the rows.

Is there a way to make this work? Ideally one where this could be run both with "carb" and carb. One with and without the quotes.

 help=function(colname){
 filter(mtcars, colname > 2)}

 results=help(carb)
runningbirds
  • 6,235
  • 13
  • 55
  • 94

0 Answers0