Pipes have been a fundamental aspect of computer programming for many decades. In short, the semantics of pipes can be thought of as taking the output from the left-hand side and passing it as input to the right-hand side. For example, in a linux shell, you might
cat example.txt | sort | uniq to take the contents of a text file, then sort the rows, then take one copy of each distinct value.
| is a common, but not universal, pipe operator and on U.S. Qwerty keyboards, is found above the RETURN key along with the backslash:
Languages that don’t begin by supporting pipes often eventually implement some version of them. In R, the magrittr package introduced the
%>% infix operator as a pipe operator and is most often pronounced as “then”. For example, “take theÂ
mtcars data.frame, THEN take the
head of it, THEN…” and so on.