Guide: Double Evaluation

https://rlang.r-lib.org/reference/topic-double-evaluation.html

Tidy eval (and in particular, data-masking) introduces a bit of a problem that people may not have thought about before:

it accepts expressions that are computations

We need to be careful about how we evaluate tidyeval expressions when we design functions, because we can fall into the trap of evaluating expressions more often than we should.

Avoid

We can sometimes avoid double-evaluation issues by evaluating the expression to create an intermediate variable

(aside: lol transmute again?)

Symbols / glue strings

Glue strings and other expression/symbol evaluation doesn’t “suffer” from this problem

  • “not suffering” meaning it doesn’t execute code and instead translates the code to text