copy a csv file in r

To copy a CSV file in R, we can use the file.copy() function. The function requires two arguments: the path of the original file and the path of the destination file.

main.r
file.copy(from = "path/to/original/file.csv", 
          to = "path/to/destination/file.csv")
94 chars
3 lines

For example, let's say we have a file called "data.csv" in our working directory, and we want to make a copy of it called "data_copy.csv" in the same directory. We can use the following code:

main.r
file.copy(from = "data.csv", to = "data_copy.csv")
51 chars
2 lines

Note that file.copy() can be used to copy any file type, not just CSV files.

gistlibby LogSnag