You can batch reformat it with the formatR package.
Assuming that you are using the File | New window and entering the code in that window then after entering the code:
select all your code (ctrl-a) and send it to the clipboard (ctrl-c) and then
set focus to the R console and enter this which will reformat the code in the clipboard and replace it on the clipboard with the reformatted code. (If you have already done this previously in the session you can just uparrow and enter to retrieve and run the prior instance.)
library(formatR)
tidy_source(file = "clipboard")
finally set focus back to the code window, select everything (ctrl-a) and paste in the reformatted code (ctrl-v) to overwrite it with the reformatted code.
You could create an AutoHotKey script to automate the entire procedure but even if you don't it's only a few keystrokes or if you are using some text editor that you didn't mention there may be automation facilities in it.