What is not working exactly ?
Can you be more precise ? this seems to work fine, so I may have missed something...
library(dplyr)
#>
#> Attachement du package : 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
tb <- tribble(
~x , ~y,
"a", 1,
"b", 2,
"c",3,
"d",4,
"a", 5,
"a", 3)
f <- function(name){
tb %>% filter(x == name)
}
f("a")
#> # A tibble: 3 x 2
#> x y
#> <chr> <dbl>
#> 1 a 1
#> 2 a 5
#> 3 a 3
Created on 2020-03-28 by the reprex package (v0.3.0.9001)