move a file in r

To move a file in R, we can use the file.rename() function. This function takes two arguments - the current file path and the new file path.

Here's an example code snippet that moves a file from the current working directory to a different directory:

main.r
# set the current and new file paths
current_path <- "old_folder/my_file.txt"
new_path <- "new_folder/my_file.txt"

# move the file using file.rename()
file.rename(current_path, new_path)
188 chars
7 lines

Make sure to specify the correct file paths and file names for the current_path and new_path variables before running the code.

gistlibby LogSnag