wrapr::let()
is designed to get several important corner cases correct: including substitutions that are disjoint from the expression and symbol swaps.
## list()
## X + Y
## [1] 3
## list()
## X + Y
## [1] 3
## list()
## X + Y
## [1] 3
## list()
## X + Y
## [1] 3
## $X
## [1] "Y"
##
## $Y
## [1] "X"
##
## Y + X
## [1] 3
## $X
## [1] "Y"
##
## $Y
## [1] "X"
##
## Y + X
## [1] 3
## $X
## [1] "Y"
##
## $Y
## [1] "X"
##
## expression(Y + X)
## [1] 3
## $X
## [1] "Y"
##
## $Y
## [1] "X"
##
## Y + X
## [1] 3