What is the getwd() function in R?
Overview
The getwd() function is used to return the current working directory in an R process.
Syntax
getwd()
Parameter value
The getwd() function takes no parameter values.
Return value
The getwd() function returns the current working directory.
Note: If the working directory is not available, it returns a character string
NULL.
Example
# invoking the getwd() functiongetwd()
Explanation
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.