X |> one |> two |> three
versus the more conventional
three(two(one(X))) X |> one |> two |> three
versus the more conventional
three(two(one(X)))These days, base R already includes a native pipe operator (and it is literally `|>`, rather than magrittr's `%>%`).
value = table:function1():function2():function3()
let x1 = one(x); let x2 = two(x1); let x3 = three(x2);
The other advantage of being explicit is you can set breakpoints and see the intermediate values when debugging.
Granted, the same could be said about `three(two(one(X)))`, so it's not specifically a pipe operator problem. It's just that I see it a lot more ever since pipe operators (or their cousins "streams", "extension methods", etc) have been popularized.
My guess is it's because `three(two(one(X)))` across multiple lines would need indentation on each nested function, and end up looking obviously obtuse with too many levels of nesting. Pipes make it look cleaner, which is great at some level, but also more tempting to get caught up in "expression golf" leading to extremely concise but incomprehensible code.