[R] rename files in R

Rui Barradas ru|pb@rr@d@@ @end|ng |rom @@po@pt
Fri Sep 16 19:38:26 CEST 2022


Hello,

Please post the first row of 2 or 3 files and the expected result.

You can rename files with ?file.rename. This function is vectorized its 
on arguments so you do not need a loop, only the source and destination 
filenames. Both vectors should have the same length, if not strange 
things will occur including data loss.

Hope this helps,

Rui Barradas

Às 18:26 de 16/09/2022, Kai Yang via R-help escreveu:
> Hello,I have a lot of files with not meaningful name, such as:  file1.txt, file2.txt ...... I need to rename them using the information from the first row of the files. Now I can get the information from the first row of each file. Now, I need know how to rename them in R (using loop?). Thank you for your helpKai
> 
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list