passing arguments to function expr() in rlang and the !! operator
问题 Define an expression > xy <- expr(x+y) Use it to build a second expression ... and it works > expr(a + !!xy) a + (x + y) simply changing the order of the arguments and it stops working > expr(!!xy + a) Error in (function (x) : object 'a' not found Am I missing something? Thanks 回答1: There is way to make it work. Change the way !!xy has been used in expr and it will work. i.e expr((!!xy) + a) #(x + y) + a The reason is that priority of all arithmetic and comparison operators are higher than !