To create a new directory in R, you can use the dir.create()
function. This function takes one argument, which is the path of the directory that you want to create. Here's an example:
main.r60 chars3 lines
You can also create a directory with multiple levels by specifying a path that includes subdirectories. For example:
main.r93 chars3 lines
If the directory already exists, dir.create()
will return FALSE
, indicating that it was not created. To avoid this, you can use the exist.ok
parameter, which will not throw an error in case the directory already exists:
main.r86 chars3 lines
That's it! You now know how to create a directory in R.
gistlibby LogSnag