Search code examples
rrscript

Running R script with RSript doesn't seem to save workspace


I am running RSCript with the --save command. When the script finishes, if I then run 'R' I do not workspace variables of script. What am I missing?

Thanks.


Solution

  • Try including save.image() at the end of your script. This will create a .Rdata file in your working directory that will save all the variables that were created by your script. To load that workspace the next time you open R, you could type in load("present/working/directory/.Rdata")

    Hope that's what you were looking for.