getwd() setwd(dir)
dir
getwd returns an absolute filename representing the current working directory of the R process; setwd(dir) is used to set the working directory to dir.
getwd
setwd(dir)
(WD <- getwd()) if (!is.null(WD)) setwd(WD)