Reputation: 49
I want to completely clear my R command history in RStudio. I'm talking about when I press the up and down arrow keys, not just clearing the console by clicking the broom.
I tried deleting the .Rhistory
file in my working directory and restarting RStudio but the file keeps restoring itself. How do I completely get rid of it?
Upvotes: 3
Views: 13608
Reputation: 166
To clear the workspace environment use:
rm(list = ls())
To clear history of commands typed use:
clearhistory <- function() {
write("", file=".blank")
loadhistory(".blank")
unlink(".blank")
}
clearhistory()
Reference:
This discussion might be helpful: Command or keyboard shortcut to clear command history in RStudio
Upvotes: 3