To rename a file in R, you can make use of the file.rename()
function. The syntax of this function is as follows:
main.r22 chars2 lines
Here, from
is the current name of the file and to
is the desired new name of the file. These file names should include the path and the file extension.
Here's an example code snippet that demonstrates how to use the file.rename()
function:
main.r220 chars9 lines
This will rename the file from current_file_name
to new_file_name
. Make sure that the path is correct and that the user has write permissions to the directory where the file is located.
gistlibby LogSnag