Since there seems to be no easy way to do this, here are a few alternatives:
Start a new instance of R and exit the old one:
system("R"); q("no")
This will completely clear your workspace. If you want to save your workspace, try:
save.image(); system("R"); q("no")
This will restore your workspace, but leave a lingering .Rdata work file. If you want to remove this:
save.image(); system("R"); unlink('.Rdata'); q("no");
But you still have to reload the packages you previously downloaded. That is, if you do not do:
lp<-(.packages()); save.image(); system("R"); unlink('.Rdata'); q("no"); rapply(as.list(lp), library); rm(lp)
which works only from the command line, since the second line must be entered into the new R.
Note. I really do not recommend this solution.
source share