Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It’s very common to do

    data <- data |>
      filter(…) |>
      mutate(…) |>
      left_join(…)
… Etc. This would simplify to

    data <|> filter(…) |> …


Not 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 > ...


purrr::map is fine for this, I think.


I 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: