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?
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With