[External] Re: New pipe operator
On Mon, Dec 7, 2020 at 10:11 AM <luke-tierney at uiowa.edu> wrote:
Or, keeping dplyr but with R-devel pipe and function shorthand:
DF <- "myfile.csv" %>%
readLines() |>
\(.) gsub(r'{(c\(.*?\)|integer\(0\))}', r'{"\1"}', .) |>
\(.) read.csv(text = .) |>
mutate(across(2:3, \(col) lapply(col, \(x) eval(parse(text = x)))))
Using named arguments to redirect to the implicit first does work,
also in magrittr, but for me at least it is the kind of thing I would
probably regret a month later when trying to figure out the code.
The gsub issue suggests that if one were to start afresh that the arguments to gsub (and many other R functions) should be rearranged. Of course, that is precisely what the tidyverse did.