3 ms·
Pipes are useful when you have multiple operations to combine, I don't think a <|> b <|> c makes as much sense?
by junke 3y ago
Pipes are useful when you have multiple operations to combine, I don't think a <|> b <|> c makes as much sense?
- dash2 3y agoIt’s very common to do data <- data |> filter(…) |> mutate(…) |> left_join(…) … Etc. This would simplify to data <|> filter(…) |> …
- tetris11 3y agoNot super related, but R also needs some way to handle lists in the pipe chain. Maybe something like `&>` to apply over all elements (and `1>`, `2>`,..., `N>`, for piping on individual elements), and a collector operator like `]>` (or `1,2-4,N]>` to collect subsets), so that one can do: > data <- data |> > split_by(field) &> > # mutate over all > mutate(calc=...) 1-5> > # filter the first 5 elems > filter(…) &]> > # control back to parent > collect() ]> > # collect all elements and > # implicit rbind them > ...
- dash2 3y agopurrr::map is fine for this, I think.
- junke 3y agoI get it, but the syntax is surprising. This is more like += etc. so I would expect a notation like ()= (ie. apply-equal) in a way that is not related to piping I guess.