.direction argument in tidyr::fill

Hi everyone,

I received a suggestion for a function for one of my R packages, and the submitter used a leading dot for one the arguments (e.g. an argument named .slide_values). To see if I should l keep the leading dot notation, I read this thread below and I'm still confused.

To learn a little more, I looked at various tidyverse functions and saw that the .direction argument in tidyr uses this notation. This argument is not involved in functional programming or legacy code, and uses this notation since it's inception (see Fill down or _up_. Fixes #114. · tidyverse/tidyr@37108ce · GitHub).

Does anyone know why?
hope this is not a silly question!

I always assumed that it was because the ... captures any variables you want to use, and "direction" is fairly likely to be the name of a variable, while ".direction" is not, so using the dot prefix would lessen the likelihood of ambiguity.

1 Like

Thanks! :dark_sunglasses:
I hadn't thought of it that way.
It definitely makes sense to disambiguate likely variables, and I hadn't seen this answer worded like you just did.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.