Use this styler for formatting code by setting this as an option:

options(styler.addins_style_transformer = "certe_style_transformer()")

Then use the keyboard shortcut of the styler package to apply the formatting.

certe_style_transformer(...)

Arguments

...

arguments passed on to styler::tidyverse_style()

Details

The Certe styler keeps the first argument of a function on the same line, puts all following arguments on a new line, and does not add another new line after the last argument. This makes these lines:

example_isolates %>% count(hospital_id, gender) %>% plot2(x.title = "Hospital", y.title = "Count", title = "Count isolates per hospital/gender")

example_isolates %>%
  count(hospital_id, gender) %>%
  plot2(x.title = "Hospital", y.title = "Count", title = "Count isolates per hospital/gender")

Change into:

example_isolates %>%
  count(hospital_id,
        gender) %>%
  plot2(x.title = "Hospital",
        y.title = "Count",
        title = "Count isolates per hospital/gender")