Uses the {styler}
package to automatically format R sources.
Details
The code is formatted according to the styler::tidyverse_style
guide with one adjustment:
spacing around math operators is not modified to avoid conflicts with box::use()
statements.
Examples
if (interactive()) {
# Format a single file.
format_r("app/main.R")
# Format all files in a directory.
format_r("app/view")
}