Has anyone articulated some principles to help me to decide if the signature of my functions should use .data
, .x
, or x
?
If the input is a data frame, use data
; if it's a vector, use x
.
Add a leading .
whenever the function also takes named ...
. If a high proportion of functions in a family take (see https://github.com/tidyverse/principles/issues/18#issuecomment-428606329)...
, you may want to use a leading .
everywhere, just for consistency.
3 Likes
I had the same question which had some useful discussion here: Function argument naming conventions (`.x` vs `x`)
Thanks @torvaney. Do you think it's worthwhile adding a pointer from there to here? Or maybe collapse the two discussions?