getwd()

The getwd() function returns the current working directory as an absolute file path. Otherwise, it returns NULL if a directory is not found.

Syntax

getwd()

The getwd() function takes no parameters.

Example

The following example showcases the getwd() function:

> getwd()
[1] "/Users/kyra/Documents"

Contributors

Interested in helping build Docs? Read the Contribution Guide or share your thoughts in this feedback form.

Learn R on Codecademy