Command or keyboard shortcut to clear command history in RStudio
Function based on Carl Witthoft's helpful comment which clears the history (assumes you can write to the working directory):
clearhistory <- function() {
write("", file=".blank")
loadhistory(".blank")
unlink(".blank")
}