file names in some folder, and save to a new folder.
Tim
-Original Message-
From: R-help On Behalf Of Kai Yang via R-help
Sent: Friday, September 16, 2022 1:52 PM
To: R-help Mailing List ; Rui Barradas
Subject: Re: [R] rename files in R
[External Email]
Hello,Here is the ex
qual to that.
>
> Do a for loop using current file names in some folder, and save to a new
> folder.
>
> Tim
>
> -Original Message-
> From: R-help On Behalf Of Kai Yang via R-help
> Sent: Friday, September 16, 2022 1:52 PM
> To: R-help Mailing List ; Rui B
are in the first row, selecting the first element from
> colnames() and setting the file name equal to that.
> >
> > Do a for loop using current file names in some folder, and save to a new
> folder.
> >
> > Tim
> >
> > -Original Message-
> > Fr
-Original Message-
> From: R-help On Behalf Of Kai Yang via R-help
> Sent: Friday, September 16, 2022 1:52 PM
> To: R-help Mailing List ; Rui Barradas
>
> Subject: Re: [R] rename files in R
>
> [External Email]
>
> Hello,Here is the example:
> file name
s
Subject: Re: [R] rename files in R
[External Email]
Hello,Here is the example:
file namefirst row file1.txt abc.txt file2.txt bed.txt
file3.txt gogo.txt . . file1243.txtlast.txt
I want to use loop because I need to read the first row information for first file,
and
Thank you. I'll try this. --- Kai
On Friday, September 16, 2022 at 11:01:33 AM PDT, Rui Barradas
wrote:
Hello,
Something like the following might work.
filenames <- list.files(pattern = "^file\\d+\\.txt$")
destnames <- sapply(filenames, scan, what = character(), sep = "\n", n =
1L,
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 yo
7 matches
Mail list logo