R provides two functions to remove files (and folder) from the file system:
unlinkfile.remove
It’s not entirely obvious what the differences are, or indeed when to use which, other than that unlink takes some additional arguments.
Reading the source code for these functions doesn’t help very much, since both simply calls a compiled C function.
What are the differences? When should you use unlink in preference to file.remove, or vice versa?
My guess is simply that
unlinkwas present in S, since it references Becker, Chambers and Wilks (1988), whereasfile.remove(and file.copy, file.create, etc.) have been part of R since early on in order to provide a family of functions for general file manipulation.unlinkcorresponds to a very old Unix function (and certainly existed when the 1988 version of S appeared): http://en.wikipedia.org/wiki/Unlink_(Unix)So,
unlinkis there for compatibility with S,file.removeis there as a part of R and both are maintained in order to support long existing code from S and R. Other than that simply choose the one that suits your needs (or habits) best.