The getwd()
function is used to return the current working directory in an R process.
getwd()
The getwd()
function takes no parameter values.
The getwd()
function returns the current working directory.
Note: If the working directory is not available, it returns a character string
NULL
.
# invoking the getwd() functiongetwd()
In the code above, we use the getwd()
function to return the working directory of the R program.
Note: The code file shown above is placed in a folder named
usercode,
which is at the root of the path. This is why the output is/usercode.