Closed FelicienLL closed 1 year ago
This is more of an RStudio issue I think.
HI, I'm not sure if this related (this is all at the edge of my mental pay grade!) but recently magrittr assignment pipe (%<>%) doesn't work - instead of assigning the chain of operations to the LHS object, it instead returns the result in the console.
However, I have also recently started using the base R pipe (|>) instead of the magrittr pipe (%>%).
When I replace base pipes with magrittr pipes, the assignment pipe works as expected. Is this something that can/should be fixed at your (magrittr team) end, or something for the base R folks? Thanks!
The |>
rewrites the input in nested form at parse time:
quote(a %<>% b() |> c())
#> c(a %<>% b())
So there is no appealing way to make it work in a %<>%
pipeline.
Will be fixed in the next version of rstudio. Thanks for your comment. https://github.com/rstudio/rstudio/issues/10538
Hello, First thank you for these awesome packages. Just reporting a minor issue: Rstudio completion does not work on "mrgmod" S4 class objects when used inside a
%>%
pipe. However, because it works with the base|>
pipe, so I assume the problem is related to magrittr, but maybe I'm wrong.These are quite special S4 objects, since they have
names()
and a$
extraction method.I tried to debug Rstudio completion method with
debug(search_envs()[["tools:rstudio"]]$.rs.getRChainCompletions)
. Just noticed that:%>%
, the valuechainObjectName
was equal to "mod", which triggers a[[ ]]
extraction of each element in names, which is the origin of the error messages. Completion aborts.|>
,chainObjectName
was NULL, thus the aforementioned extraction step is skipped (if(length(chainObjectName))
statement), and the completion is provided by an other part of the code. Named elements never got evaluated and the proposed completion was accurate (i.e. returned the arguments of themrgsim
function, but it is the same for any function).Was this difference between
|>
and%>%
expected at this point? Is it only related to the non-standard construction of these "mrgmod" objects, or could something be fixed on your side? Or do you think it is more related to Rstudio?Many thanks in advance
Félicien