Brenton Wiernik
2021-Jun-19 18:33 UTC
[Rd] Additional an example for the forward pipe operator's documentation
> mtcars |> subset(cyl == 4) |> lm(formula = mpg ~ disp)This isn?t really a reliable approach. It works for `lm()`, where `data` is the second argument, but not for `glm()` unless the first _two_ arguments are named. mtcars |> subset(cyl == 4) |> glm(formula = mpg ~ disp, family = "gaussian") It would basically never work for `metafor::rma()`, where `data` is over a dozen arguments into the list. In short, reliance on convenient placement of `data` in the argument list probably isn?t something the documentation should encourage. The anonymous function syntax can be made more aesthetically appealing through effective use of indentation and line breaks (https://twitter.com/bmwiernik/status/1402565800691634182?s=20), eg: mtcars |> subset(cyl == 4) |> ( \(data) lm(mpg ~ disp, data = data )() [[alternative HTML version deleted]]