delete a csv file in r

To delete a CSV file in R, you can use the file.remove() function. This function is used to delete one or more files.

To delete a single CSV file named "file.csv" in the current working directory, simply run:

main.r
file.remove("file.csv")
24 chars
2 lines

If you want to delete multiple files (CSV or other), you can pass a vector of file names to the file.remove() function, like this:

main.r
file.remove(c("file1.csv", "file2.csv", "file3.csv"))
54 chars
2 lines

Note that the file.remove() function cannot delete a directory. If you want to delete a directory and all its contents, use the unlink() function instead.

gistlibby LogSnag