Feature request:
When we use add_tally or add_count it generates a new variable named "n". It would be nice to have an argument where we could specify the new variable name. I think the code would be clearer.
Thanx
Maybe it'd make sense to allow :=?
Would be nice if this option could be extended to count() and tally() as well.
I think count() and tally() are already sufficiently complicated. If you want to specify the name, just do the summary yourself.
My two cents, since I encounter this issue often:
I agree that it is unnecessary for count() and tally() where only one count column is generated.
However for add_count(), given that often multiple count columns are added, being able to name the new column would be much cleaner, since ending up with n, nn, nnn is no good, and having to do a
df %>%
add_count(x) %>%
add_count(y) %>%
rename(countx = n,
county = nn)
is prone to breakage since n/nn is dependent on order (and even doing renames in between seems messy).
naming the output of add_count() like add_count(countx = x) doesn't seem overly complicated.
This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/
Most helpful comment
My two cents, since I encounter this issue often:
I agree that it is unnecessary for
count()andtally()where only one count column is generated.However for
add_count(), given that often multiple count columns are added, being able to name the new column would be much cleaner, since ending up withn,nn,nnnis no good, and having to do ais prone to breakage since
n/nnis dependent on order (and even doing renames in between seems messy).naming the output of
add_count()likeadd_count(countx = x)doesn't seem overly complicated.