You can use Vim commands to move the cursor from window to another. One of such commands is CTRL-W w
Please, see Vim's documentation:
:h window-moving
Once you are in the R Console, press the key i to go to insert mode. Then you can type command directly in the R console. See:
:h R_in_buffer