R CMD BATCH your_r_code_file &
Then, reattach to your screen session by logging back into the server and typing
If you need to know more about screen, see the man page for screen (man screen). The idea is to run an ssh session inside a screen session. This will ensure that your AFS tokens remain valid after you leave the computer for hours, days, or weeks at a time.
TIP: you can avoid having to use the stashticket command every time if you put
/s/std/bin/stashticket in your ~/.bashrc.local (or
~/.cshrc.local, depending on which shell you're using)