Skip to content
Prev 57577 / 63421 Next

[External] Re: should base R have a piping operator ?

On Mon, 7 Oct 2019, Lionel Henry wrote:

            
You get the assignment behavior with the nested call approach. (Not
that doing this is necessarily a good idea).
Here is a stylized example:

f <- function(x, y) {
     assign("xx", x, parent.frame())
     on.exit(rm(xx, envir = parent.frame()))
     y
     get("xx") + 1
}

## This is fine:
[1] 2

## This is not:
Error in get("xx") : object 'xx' not found

If you play these games whether you get the result you want, or an
obvious error, or just the wrong answer depends on argument evaluation
order and the like. You really don't want to go there. Not to mention
that you would be telling users they are not allowed to use '.' as a
variable name for their own purposes or you would be polluting their
environment with some other artificial symbol that they would see in
debugging. Just don't.

Anything going in base needs to worry even about artificial cases.
Yes, there are things in base that don't meet that standard. No, that
is not a reason to add more.
Should be able to get there now. Needed to change the visibility ---
still learning my way around gitlab.

Best,

luke

  
    

Thread (33 messages)

Ant F should base R have a piping operator ? Oct 5 Jeff Ryan should base R have a piping operator ? Oct 5 John Mount should base R have a piping operator ? Oct 5 Hugh Marera should base R have a piping operator ? Oct 5 David Hugh-Jones should base R have a piping operator ? Oct 5 Ant F should base R have a piping operator ? Oct 5 John Mount should base R have a piping operator ? Oct 5 Rui Barradas should base R have a piping operator ? Oct 5 Iñaki Ucar should base R have a piping operator ? Oct 5 Iñaki Ucar should base R have a piping operator ? Oct 5 Ant F should base R have a piping operator ? Oct 5 Hugh Marera should base R have a piping operator ? Oct 5 Iñaki Ucar should base R have a piping operator ? Oct 5 Ant F should base R have a piping operator ? Oct 5 Gabriel Becker should base R have a piping operator ? Oct 5 Joris Meys should base R have a piping operator ? Oct 6 Iñaki Ucar should base R have a piping operator ? Oct 6 John Mount should base R have a piping operator ? Oct 6 Duncan Murdoch should base R have a piping operator ? Oct 6 Ant F should base R have a piping operator ? Oct 6 Lionel Henry should base R have a piping operator ? Oct 7 Duncan Murdoch should base R have a piping operator ? Oct 7 Lionel Henry should base R have a piping operator ? Oct 7 Duncan Murdoch should base R have a piping operator ? Oct 7 Lionel Henry should base R have a piping operator ? Oct 7 Luke Tierney should base R have a piping operator ? Oct 7 Lionel Henry should base R have a piping operator ? Oct 7 Luke Tierney should base R have a piping operator ? Oct 7 Kevin Ushey should base R have a piping operator ? Oct 7 Lionel Henry should base R have a piping operator ? Oct 7 Lionel Henry should base R have a piping operator ? Oct 7 Luke Tierney should base R have a piping operator ? Oct 7 Luke Tierney should base R have a piping operator ? Oct 7