I recently tried hacking some custom "commands" into the R REPL. I thought the method was fun and interesting enough to be worth sharing.
In other language REPLs/interactive prompts, there are often a couple of special commands. Some of the more common ones are exit
(to exit the session) and clear
(to clear the buffer).
I often find myself instinctively attempting to use these in R. Of course, they do not exist in R. To terminate the R session, one can use quit(...)
or q(...)
, but this requires typing brackets, as well as a "no"
if you want to avoid that annoying "save workspace?" prompt.