getwd {base}R Documentation

Get or Set Working Directory

Description

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.

Usage

getwd()
setwd(dir)

Arguments

dir A character string.

Value

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.
setwd returns the currrent directory before the change, invisibly. It will give an error if it does not succeed.

Note

These functions are not implemented on all platforms.

See Also

list.files for the contents of a directory.

Examples

(WD <- getwd())
if (!is.null(WD)) setwd(WD)

[Package base version 2.4.1 Index]