Two main questions:
-
why the name, and is there an alternative: I'm working off the possible precedent of
add_predictions,add_predictors, andadd_residualsfrom the modelr package. These are functions that take a table and add specifically calculated columns, like the above.The alternative we've used in the tidytext package is bind_tf_idf, when we add three columns (
tf,idf, andtf_idf) to a table without otherwise changing it. If there's another prefix that means "add a column" I'm open to it, though I don't thinkmutate_orappend_would be right.We could try to come up with clever verbs that don't refer to count or tally specifically (like...
enumerateandtickor something) but I think that's making it more obscure -
why the grouping behavior: I think it is important to return the tbl to its original grouping, because most of the time when this verb is useful, it is immediately followed by filtering or mutating, which are faster when ungrouped. (filtering is a particularly common pitfall). I also think that if the grouping behavior were preserved, one might as well just have used
group_byso that it's clearer