Skip to content
Prev 393513 / 398503 Next

Pipe operator

The other responses here have been very good, but I felt it necessary to point out that the concept of a pipe originated around when you started programming [1] (text based). It did take awhile for it to migrate into programming languages such as OCaml, but Powershell makes extensive use of (object-based) pipes.

Re memory use: not so much. Variables are small... it is the data they point to that is large, and it is not possible to analyze data without storing it somewhere. But when the variables are numerous they can interfere with our ability to understand the program... using pipes lets us focus on results obtained after several steps so fewer intermediate values clutter the variable space.

Re speed: the magrittr pipe (%>%) is much slower than the built-in pipe at coordinating the transfer of data from left to right, but that is not usually significant compared to the computation speed on the actual data in the functions.

 [1] https://en.m.wikipedia.org/wiki/Pipeline_(Unix)#:~:text=The%20concept%20of%20pipelines%20was,Ritchie%20%26%20Thompson%2C%201974).
On January 3, 2023 9:13:22 AM PST, "Sorkin, John" <jsorkin at som.umaryland.edu> wrote: