CptanPanic
CptanPanic

Reputation: 858

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.

Upvotes: 3

Views: 2064

Answers (2)

vtshen
vtshen

Reputation: 202

The Rscript works for me. Need to use the command, la, to see the generated file .RData

Rscript --save test.R

Upvotes: 1

kairavichahal
kairavichahal

Reputation: 203

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.

Upvotes: 2

Related Questions