To find the path of a directory in R, you can use either getwd()
or setwd()
.
getwd()
will return the current working directory, while setwd()
can be used to set a new working directory.
Here is an example of how to use getwd()
:
main.r44 chars3 lines
This will return the path of the current working directory.
Here is an example of how to use setwd()
:
main.r58 chars3 lines
This will set the working directory to the specified directory path.
You can also use file.path()
to create a platform-independent file path, like this:
main.r89 chars3 lines
This will create a file path to a directory using the file.path()
function.
gistlibby LogSnag