Closed billdenney closed 3 years ago
Thank you for this suggestion. I think #42 is essentially the same idea.
I'm reluctant to do it for a couple of reasons.
One reason is that all the other arguments would also have to accept vectors, and the formatters
argument is already a list, so would become a list of lists.
The other reason is that I think it's important to retain the concept of behead()
stripping exactly one layer at a time, because it makes debugging easier, and I think users are more likely to realise that the order of operations matters. It also allows the locatr package to work, and is consistent with the reverse operation of the mmtable2 package (constructing layered tables).
In other words, the repetitive behead()
s are, I think, a feature! Before I wrote this package, there were others that did similar things with a single call, which ended up constraining them, so for unpivotr I adopted the dplyr style of sequencing simple, incremental transformations.
Thanks for the follow-up. It makes sense as a feature.
Related to #42 (and maybe it's a duplicate of #42, but I'm not sure).
I often have data with multiple rows or columns of header-type information to the sides. A common case for me would look like:
And, I'd like to be able to extract multiple
behead()
s in one call so that my code does not become many sequentialbehead()
calls. For the example above, it would look like:Or perhaps for extra flexibility (which may be more than is desired:
I'm not sure if I like the second example because it may lead to less-readable code, overall.
If this would be a feature of interest, I'm happy to make a PR for it.