[R] Changing working directory

Uwe Ligges ligges at statistik.uni-dortmund.de
Mon Apr 23 14:14:24 CEST 2007



Walter Paczkowski wrote:
> Good morning,
> 
> I keep copies my .RData file in different directories for different projects on Windows XP.  There is an icon on my desktop for each project so all I have to do is click on the icon to open R for a specific project, i.e. a specific .RData file.  How do I change to another .RData file from within R without first closing R?


Best practice is to avoid using Workspaces at all.
If you really want to do what you are asking for:

# save current workspace, if you really ...
save.image()
# clean up current Workspace:
rm(list=ls(all=TRUE))
setwd("/path/to/other/.RData")
load(".RData")

Uwe Ligges


> Thanks,
> 
> Walt Paczkowski
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list