Best practices when writing a new package is to call other package functions using the package::function()
syntax and keeping the namespace clean. What is the equivalent operation for telling R to use rlang's !!
and :=
when I'm using them inside a a package's function, since they have no functional form? Using load_all() things seem to work fine but I want to make sure they're not just working because something else loaded rlang already into my path.
Asked
Active
Viewed 226 times
1

Guillermo
- 99
- 6
-
1Possible duplicate: https://stackoverflow.com/questions/55383205/how-to-use-rlang-operators-in-a-package – MrFlick Oct 17 '21 at 06:24
-
@MrFlick: Thank you, the answer to that question does indeed answer this one. – Guillermo Oct 18 '21 at 00:47
1 Answers
1
They do not need importing:
. !! and !!! behave specially inside all quoting functions powered by rlang, where they behave like real operators with precedence equivalent to unary + and -. This requires considerable work inside rlang, but means that you can write !!x + !!y instead of (!!x) + (!!y).
From a previous question
Once an rlang function detects this "operator" it treats it differently to perform the tidy evaluation necessary (which is why the operator is only useful in a rlang context) ... This is why you only need to import the rlang function you want, because the logic for dealing with !! lies inside rlang internals, not a separate function

Guillermo
- 99
- 6