Formatting for one line pipes

We're having an internal discussion on code style (that I'm losing). So I thought I would appeal to a higher authority.

Which of the following is the recommended formatting method:

# Option 1
dplyr::filter(x, year == 2017)
# Option 2
x %>% dplyr::filter(year == 2017)
# Option 3
x %>% 
   dplyr::filter(year == 2017)

My preference would be Option 3 since it conforms with the style for longer manipulations (in which case it improves readability). I also think it improves readability in this single-line (well, two-line) instance, although not by much.

This topic was automatically closed 21 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.