In RStudio, I am having trouble properly aligning function arguments when using the auto-indent tool (ctrl+I). The resulting function definitions either end up vertically misaligned or with too many spaces before each argument. I want just one tab space before each argument.
Here are the current outcomes when adjusting vertically_align_arguments_indent:
- Output 1: Using
rstudioapi::writeRStudioPreference("vertically_align_arguments_indent", FALSE)
MyFunction <- function(
arg1,
arg2,
arg3
) {
# stuff
}
- Output 2: Using
rstudioapi::writeRStudioPreference("vertically_align_arguments_indent", TRUE)
MyFunction <- function(
arg1,
arg2,
arg3
) {
# stuff
}
Instead, I would like the auto-indent tool to produce the following output:
MyFunction <- function(
arg1,
arg2,
arg3
) {
# stuff
}
Can someone suggest the correct RStudio settings to achieve my desired output?
NB: I cannot solve this just by setting the tab spacing to be shorter. If I do it the body of the function will keep on being unaligned with the arguments.