You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm sure there's a simple fix/workaround out there, but I couldn't find anything online regarding this issue. The pipe is pretty central to the tidyverse, but I understand if the glue wasn't meant to be used with "unnamed" variables (such as the pipe's (.)), so the solution might just be some documentation/awareness around this, rather than changing glue to work with the above issue.
Using R 3.6.2 and glue 1.4.2
The text was updated successfully, but these errors were encountered:
Actually looks like this more of an issue with how the pipe handles using the placeholder (.) when it appears in a nested expression.
It is straightforward to use the placeholder several times in a right-hand side expression. However, when the placeholder only appears in a nested expressions magrittr will still apply the first-argument rule. The reason is that in most cases this results more clean code.
...
The behavior can be overruled by enclosing the right-hand side in braces:
We can actually solve the problem by just adding brackets around the glue command in the pipe:
"bob" %>%
{glue("hello {.}")}
# [1] hello bob
Would you guys be interested in a pull request mentioning this in the documentation? Might not be necessary since it's referenced indirectly in the Magrittr documentation.
So usually in a pipe we use "." to not pass the left-hand side of the pipe to the first parameter.
For instance:
But it doesn't seem to work properly with glue:
I'm sure there's a simple fix/workaround out there, but I couldn't find anything online regarding this issue. The pipe is pretty central to the tidyverse, but I understand if the glue wasn't meant to be used with "unnamed" variables (such as the pipe's (.)), so the solution might just be some documentation/awareness around this, rather than changing glue to work with the above issue.
Using R 3.6.2 and glue 1.4.2
The text was updated successfully, but these errors were encountered: