To copy a directory in R, we can use the file.copy()
function that copies one or more files from one location to another. To copy a directory, we need to specify the source directory and the destination directory.
Here's a sample code snippet that copies an entire directory:
main.r261 chars9 lines
The file.copy()
function copies the directory recursively, which means it copies all the subdirectories and files within the source directory. The recursive
argument in the function specifies whether to copy the directory and its contents recursively or not.
Note that if the destination directory already exists, the file.copy()
function will overwrite the existing directory and its contents.
gistlibby LogSnag