Workspaces are .RData files and not .R..R files are source files, that is, text files containing code.
This is a bit complicated. If you saved the workspace, then R saves two files in the current working directory: the .RData file with objects and the .RHistory file with command history. In earlier versions of R, this was saved in the R folder itself. With my version 2.11.1, it uses the desktop.
If you run your R, and he says: "[Previously saved workspace restored]", then he downloaded the file .RData and .Ristory from the default working directory. You will find it on command
getwd()
If it is not a desktop or so, then you can use
dir()
to see what's inside. This does not work for me, since I only have the file "desktop.ini" (thanks, bloody Windoze).
Now there are 2 options: you manually rename the workspace or use the command:
save.image(file="filename.RData")
to save work areas before exiting. Alternatively, you can set these parameters in the Rprofile.site file. This is a text file containing the R code that should be run at startup. The file is located in the / etc subdirectory of your R directory. You can add something like the following to the bottom of the file:
fn <- paste("Wspace",Sys.Date(),sep="") nfiles <- length(grep(paste(fn,".*.RData",sep=""),dir())) fn <- paste(fn,"_",nfiles+1,".RData",sep="") options(save.image.defaults=list(file=fn))
Beware: this does nothing if you save the workspace by clicking yes in the message box. You must use the command
save.image()
before closing the R-session. If you click Yes, it will save the workspace as ".RData", so you will have to rename it again.