Closed KadeG closed 8 months ago
I love this idea. It should be doable as long as I can figure out how begin-end
blocks look in the abstract syntax tree.
When I started working on Tidier.jl a year ago, I remember seeing this functionality in DataFramesMeta and not fully grasping its purpose. I definitely get it now. Will put this on the list of things to work on.
Hi @KadeG, this is basically implemented in the latest PR. Just waiting for tests to pass and then may add a new documentation page to highlight this new optional syntax before merging. The nice thing is that it is implemented for every macro that supports multiple expressions. Thanks again for the suggestion!
Wonderful! I'll play with it and let you know if I notice anything strange. I'm happy to help with docs.
Added some examples of this behavior to the @mutate
and @summarize
docstrings. This functionality works throughout the package and supports all macros that accept multiple expressions.
I ended up adding a more general page on how piping works.
Take a look: https://tidierorg.github.io/TidierData.jl/latest/examples/generated/UserGuide/piping/
I highlight the support for begin-end
blocks towards to end of the text on that page.
Currently to apply, for example, a series of
@mutate
s you might use:This is generally clear and nice for wrangling data with many columns. In
DataFramesMeta
it could look like the above (plus:
for column names), or:Eliminating
,
and()
management when nesting and doing other visually messy things is especially nice. It also allows for easier experimentation and debugging by commenting out expressions, and is visually tidier. Currently inTidier
this runs:but the parser doesn't know what to make of this:
This seems like some nice syntactic sugar in-line with the rest of
Tidier
.