Re: [R] Pipe operator

2023-01-04 Thread avi.e.gross
and subsequent arguments match up to. -Original Message- From: R-help On Behalf Of Richard O'Keefe Sent: Wednesday, January 4, 2023 1:56 AM To: Milan Glacier Cc: R-help Mailing List Subject: Re: [R] Pipe operator This is both true and misleading. The shell pipe operation came from functio

Re: [R] Pipe operator

2023-01-03 Thread Ivan Calandra
Maybe I missed it in the whole discussion, but since R 4.2.0 the base R pipe operator also has a placeholder '_' to specify where the result of the left-hand side should be used in the right-hand side (see https://stat.ethz.ch/pipermail/r-announce/2022/000683.html). So the only difference

Re: [R] Pipe operator

2023-01-03 Thread Richard O'Keefe
This is both true and misleading. The shell pipe operation came from functional programming. In fact the shell pipe operation is NOT "flip apply", which is what |> is, but it is functional composition. That is out = let out = command cmd1 | cmd2 = \x.cmd2(cmd1(x)). Pragmatically, the Unix shell

Re: [R] Pipe operator

2023-01-03 Thread Milan Glacier
With 50 years of programming experience, just think about how useful pipe operator is in shell scripting. The output of previous call becomes the input of next call... Genious idea from our beloved unix conversion... On 01/03/23 16:48, Sorkin, John wrote: I am trying to understand the reason

Re: [R] Pipe operator

2023-01-03 Thread Richard O'Keefe
does the same thing as %>%, or at my level of programing I > have not encountered a difference. > > Tim > > -Original Message- > From: R-help On Behalf Of Sorkin, John > Sent: Tuesday, January 3, 2023 11:49 AM > To: 'R-help Mailing List' > Subject: [R] Pipe op

Re: [R] Pipe operator

2023-01-03 Thread avi.e.gross
s complex in situations like this. Just use a simple assignment pre or post as meets your needs. -Original Message- From: Boris Steipe Sent: Tuesday, January 3, 2023 2:01 PM To: R-help Mailing List Cc: avi.e.gr...@gmail.com Subject: Re: [R] Pipe operator Working off Avi's example - would

Re: [R] Pipe operator

2023-01-03 Thread Richard O'Keefe
The simplest and best answer is "fashion". In FSharp, > (|>);; val it: ('a -> ('a -> 'b) -> 'b) The ability to turn f x y into y |> f x makes perfect sense in a programming language where Currying (representing a function of n arguments as a function of 1 argument that returns a function of n-1

Re: [R] Pipe operator

2023-01-03 Thread Sorkin, John
Jeff, Thank you for contributing important information to this thread. From: Jeff Newmiller Sent: Tuesday, January 3, 2023 2:07 PM To: r-help@r-project.org; Sorkin, John; Ebert,Timothy Aaron; 'R-help Mailing List' Subject: Re: [R] Pipe operator

Re: [R] Pipe operator

2023-01-03 Thread Jeff Newmiller
> R is a functional language, hence the pipe operator is not needed. Not factual... just opinion. Please be conscious of your biases and preface opinion with a disclaimer. I heard identical complaints from embedded assembly language programmers when C became all the rage... "don't need another

Re: [R] Pipe operator

2023-01-03 Thread Uwe Ligges
R is a functional language, hence the pipe operator is not needed. Also it makes the code unreadable as it is less obvious how a call stack looks like and what the arguments to the function calls are. It is relevant for a shell for piping text streams. If people cannot live without the pipe

Re: [R] Pipe operator

2023-01-03 Thread Ivan Calandra
Dear John, some more experienced users might give you a different and more helpful answer, but I was not really convinced by the pipe operator until I tried it out, for the same reasons as you. In my opinion, the pipe operator is there only to improve the readability of your code. Think

Re: [R] Pipe operator

2023-01-03 Thread Andrew Hart via R-help
-Original Message- From: R-help On Behalf Of Sorkin, John Sent: Tuesday, January 3, 2023 11:49 AM To: 'R-help Mailing List' Subject: [R] Pipe operator I am trying to understand the reason for existence of the pipe operator, %>%, and when one should use it. It is my understanding

Re: [R] Pipe operator

2023-01-03 Thread Rui Barradas
Às 19:14 de 03/01/2023, Rui Barradas escreveu: Às 17:35 de 03/01/2023, Greg Snow escreveu: To expand a little on Christopher's answer. The short answer is that having the different syntaxes can lead to more readable code (when used properly). Note that there are now 2 different (but somewhat

Re: [R] Pipe operator

2023-01-03 Thread Jeff Newmiller
nly selected rows and pipe that >> to a function that drops some of the columns and pipe that to a function >> that groups the items or sorts them and pipe that to a function that does a >> join with another object or generates a report or so many other things. >> >> So th

Re: [R] Pipe operator

2023-01-03 Thread Rui Barradas
Às 17:35 de 03/01/2023, Greg Snow escreveu: To expand a little on Christopher's answer. The short answer is that having the different syntaxes can lead to more readable code (when used properly). Note that there are now 2 different (but somewhat similar) pipes available in R (there could be

Re: [R] Pipe operator

2023-01-03 Thread Jeff Newmiller
graming I have not >encountered a difference. > >Tim > >-Original Message- >From: R-help On Behalf Of Sorkin, John >Sent: Tuesday, January 3, 2023 11:49 AM >To: 'R-help Mailing List' >Subject: [R] Pipe operator > >[External Email] > >I am trying to und

Re: [R] Pipe operator

2023-01-03 Thread Boris Steipe
s a report or so many other things. > > So the real answer is that piping is another WAY of doing things from a > programmers perspective. Underneath it all, it is mostly syntactic sugar and > the interpreter rearranges your code and performs the steps in what seems > like a differen

Re: [R] Pipe operator

2023-01-03 Thread avi.e.gross
Message- From: R-help On Behalf Of Ebert,Timothy Aaron Sent: Tuesday, January 3, 2023 12:08 PM To: Sorkin, John ; 'R-help Mailing List' Subject: Re: [R] Pipe operator The pipe shortens code and results in fewer variables because you do not have to save intermediate steps. Once you get used

Re: [R] Pipe operator

2023-01-03 Thread avi.e.gross
--Original Message- From: R-help On Behalf Of Sorkin, John Sent: Tuesday, January 3, 2023 11:49 AM To: 'R-help Mailing List' Subject: [R] Pipe operator I am trying to understand the reason for existence of the pipe operator, %>%, and when one should use it. It is my understanding that

Re: [R] Pipe operator

2023-01-03 Thread Greg Snow
To expand a little on Christopher's answer. The short answer is that having the different syntaxes can lead to more readable code (when used properly). Note that there are now 2 different (but somewhat similar) pipes available in R (there could be more in some package(s) that I don't know about,

Re: [R] Pipe operator

2023-01-03 Thread Ebert,Timothy Aaron
. Tim -Original Message- From: R-help On Behalf Of Sorkin, John Sent: Tuesday, January 3, 2023 11:49 AM To: 'R-help Mailing List' Subject: [R] Pipe operator [External Email] I am trying to understand the reason for existence of the pipe operator, %>%, and when one should use it

Re: [R] Pipe operator

2023-01-03 Thread Sorkin, John
-Original Message- From: R-help On Behalf Of Sorkin, John Sent: Tuesday, January 3, 2023 11:49 AM To: 'R-help Mailing List' Subject: [R] Pipe operator [External Email] I am trying to understand the reason for existence of the pipe operator, %>%, and when one should use it. It i

Re: [R] Pipe operator

2023-01-03 Thread Ebert,Timothy Aaron
I have not encountered a difference. Tim -Original Message- From: R-help On Behalf Of Sorkin, John Sent: Tuesday, January 3, 2023 11:49 AM To: 'R-help Mailing List' Subject: [R] Pipe operator [External Email] I am trying to understand the reason for existence of the pipe op

[R] Pipe operator

2023-01-03 Thread Sorkin, John
I am trying to understand the reason for existence of the pipe operator, %>%, and when one should use it. It is my understanding that the operator sends the file to the left of the operator to the function immediately to the right of the operator: c(1:10) %>% mean results in a value of 5.5