Rename Files Using R
In this article, we are going to see how to rename files using R Programming Language.
To rename a file in R we use file.rename(). This function renames all the files mentioned as parameters. It returns normally TRUE for success, FALSE for failure.
Note: File naming conventions depend on the platform.
Syntax: file.rename( to, from)
- to: character vector that contains all the files to be renamed
- from: character vector that contains new names for file
File for demonstration:
Below is the implementation:
Here we first list out the working directory and then use rename() function to rename the file name.