markfairbanks / tidytable

Tidy interface to 'data.table'
https://markfairbanks.github.io/tidytable/
Other
449 stars 33 forks source link

Add `verb()` (dotless) syntax #572

Closed markfairbanks closed 2 years ago

markfairbanks commented 2 years ago

Feedback welcome

Overview:

Time to add "dotless" functions (like arrange()/mutate()/etc.) like was discussed in #374. However instead of a global option to turn-on/turn-off this feature, tidytable will just add the dotless syntax. The verb.() syntax will remain in the package.

Positives for users:

Negatives:

In 374 the final decision had two parts:

I think overwriting tidyverse functions with the dotless versions would be a pretty unexpected change at this point and could lead to too many issues in user's code.

tidytable is more or less at the point of feature parity with dplyr/tidyr, so this shouldn't cause too many issues. I've also decided to add group_by()/ungroup() functions.

And creating an options() to allow dotless versions could lead to some confusion as well as it wouldn't be usable for package development

This would also be completely fixed as it wouldn't be a global option. Package maintainers could use the dotless version if they want.

AltfunsMA commented 2 years ago

One of the positives of this is that typing, e.g., "arr" in any IDE will immediately get you the tidytable version of arrange no matter what. I still would prefer not to see the choice between arrange and arrange. when I type, but this is largely aesthetic. If possible to implement, perhaps an optional switch to turn off the dotted versions would be good?

Thanks for your amazing work on this package!

mattsams89 commented 2 years ago

I typically use tidyverse packages sparingly and load them explicitly when I do, so me loading tidytable -> tidyverse would be pretty rare. At any rate, I like the dot syntax as it helps me distinguish the occasional use cases where tidytable behaves differently (e.g. enframe() and the unnest() variants when dealing with some of the ultra-nested json nonsense sport tech companies like to use). I suppose that's what keeping the dot functions in the package is for, though ¯\_(ツ)_/¯. So more than likely, my workflow of using the dot versions of functions and explicitly calling tidyverse versions of functions wouldn't change all that much.

I know my former boss isn't a fan of the dot syntax and was happy to hear about group_by.(), so I could see the appeal for more "familiar" syntax for folks who've been using dplyr, etc. for a long time. I'll ask a couple of our analysts upstairs (relatively recent tidytable converts) to see if they have any thoughts!

mattsams89 commented 2 years ago

I think map_df.() got lost on its way to the function export. Haha. Though, to be fair, there are a metric ton of map variants.

markfairbanks commented 2 years ago

I think map_df.() got lost on its way to the function export

Thanks for catching this.

Though, to be fair, there are a metric ton of map variants.

Lol there really are. I have tests for _dfr but didn't have them for _df.