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 that platform.
`setwd` returns `NULL` 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.3.1 Index]