In RStudio, you can highlight code and use the shortcut
command shift A (I think on Windows it is
control shift A) to auto-reformat your code style. RStudio has its own opinion about how code should be formatted. Personally I don't care what the opinion is, I just want it to be consistent, but I find some of the results of this shortcut unpredictable. Are the style rules that this shortcut uses available somewhere? Lo, I have searched everywhere but alas, I cannot find this anywhere. Any help would be appreciated!