I'm trying to make R restart on quit, so I'm using .Last in my .Rprofile. Solution modified from Quit and restart a clean R session from within R?, and I've tried the other solutions in that answer to no avail. my .First() works fine, but when I q() at the end, it prompts for "save workspace image?" and after answering, it insta-closes
.Last <- function()
{
print("new R in 3 seconds")
Sys.sleep(3)
system("R --no-save")
print("close R in 3 seconds")
Sys.sleep(3)
}
print("test")
(the print at the end is because there's a hidden "feature" where .Rprofile ignores the last line if theres no newline, I know it shouldn't execute that.)