Skip to content
Prev 105863 / 398506 Next

set up directory for R when I start R

Aimin Yan wrote:
Hi Aimin,
There is a discussion of how to set up different start up commands, 
usually for attaching to icons, in "Kickstarting R":

http://cran.r-project.org/doc/contrib/Lemon-kickstart/kr_start.html

You can also write an R file that can branch to a number of different 
directories on start up. Basically a bunch of statements like:

cat("(C)at studies\n")
cat("(D)og studies\n")
...
answer<-readline("")
if(toupper(strsplit(answer,"")[1]) == "C") setwd("/home/jim/cats")
if(toupper(strsplit(answer,"")[1]) == "D") setwd("/home/jim/dogs")
...


Jim