Helper functions for styling via RStudio Addins.




  • style_active_file: Styles the active file with tidyverse_style() and strict = TRUE.

  • style_selection: Styles the highlighted selection in a .R or .Rmd file.

Auto-Save Option

By default, both of the RStudio Addins will apply styling to the (selected) file contents without saving changes. Automatic saving can be enabled by setting the environment variable save_after_styling to TRUE.

Consider setting this in your .Rprofile file if you want to persist this setting across multiple sessions. Untitled files will always need to be saved manually after styling.

See also