The R console can be exited by using q().

> q()
Save workspace image? [y/n/c]:

The quit command prompts the ability to save your R session. Respond to the prompt, where y=yes, n=no, and c=cancel.