I would build the quosure outside and use quo_name to get character for pasting. on way to do based on your example (not the cleanest)
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
library(tibble)
df <-
tibble::tribble(
~a, ~a_b,
1, NA,
2, 4,
3, 5
)
# make a quosure
quo_a <- quo(a)
# use quo_name to get the name of the variable in a quosure
df %>%
mutate(c = if_else(is.na(!!sym(paste0(quo_name(quo_a), '_b'))), 0, !!sym(paste0(quo_name(quo_a)))))
#> # A tibble: 3 x 3
#> a a_b c
#> <dbl> <dbl> <dbl>
#> 1 1 NA 0
#> 2 2 4 2
#> 3 3 5 3
df %>%
mutate_at(vars(!!sym(paste0(quo_name(quo_a), "_b"))), funs(c = if_else(is.na(.), 0, .)))
#> # A tibble: 3 x 3
#> a a_b c
#> <dbl> <dbl> <dbl>
#> 1 1 NA 0
#> 2 2 4 4
#> 3 3 5 5