getwd {base} | R Documentation |
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)
dir |
A character string. |
getwd
returns a character vector, or NULL
if the working
directory is not available. On Windows the path returned will use
/
as the path separator. The path will not have a trailing
/
unless it is the root directory (of a drive or share on
Windows).
setwd
returns the current directory before the change,
invisibly. It will give an error if it does not succeed.
These functions are not implemented on all platforms.
list.files
for the contents of a directory.
(WD <- getwd()) if (!is.null(WD)) setwd(WD)