Description Usage Arguments Options and default values Note
Though they are specific to the rfmt code formatter, these functions
mirror options and getOption in base R in their behavior.
1 2 3 | options_rfmt(...)
getOption_rfmt(x, default = NULL)
|
x |
a character string naming an |
default |
value supplied if the specified option is not set (for
compatibility; not particularly applicable in this instance, because all
|
... |
named arguments used to set option values. See below for the available options. A single named list may also be provided. |
backupIf TRUE, the formatter copies the source file fn to the
file fn.bak.
Default: TRUE.
margin0The offset (from the left-most column) of the “soft” right margin
(where the layout algorithm is encouraged to break lines).
Default: 0.
margin1The offset (from the left-most column) of the “hard” right margin
(where the layout algorithm is mandated to break lines, if at all
possible).
Default: 80.
cost0The cost of each character beyond the soft right margin, margin0.
Default: 0.05.
cost1The cost of each character beyond the hard right margin, margin1.
Default: 100.
costbThe cost associated with the introduction of a newline.
Default: 2.
indentThe number of spaces introduced by each successive indent.
Default: 2.
force.braceWhether to insert braces in “control flow” constructs, such as
if or while, that lack them.
Default: FALSE.
space.arg.eqWhether to surround “=” signs in argument lists with
spaces.
Default: TRUE.
quietWhether to suppress output of all diagnostic information.
Default: TRUE.
adj.commentMultiplier applied to the cost of a newline when formatting comments.
Default: 0.5.
adj.flowMultiplier applied to the cost of a newline when formatting
“control flow” constructs, such as if or while.
Default: 0.3.
adj.callMultiplier applied to the cost of a newline when formatting function
calls.
Default: 0.5.
adj.argMultiplier applied to the cost of a newline when formatting argument
expressions in function calls.
Default: 5.
cpackSmall penalty favoring justified layouts with elements packed onto
earlier lines.
Default: 1e-3.
For a description of the layout algorithm used in rfmt, look in
the “User guides, package vignettes and other documentation” section
of the package documentation for the technical report
“A New Approach to Optimal Code Formatting”.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.