Re: [R] Suggestions for vectorizing/double loop

2017-01-23 Thread PIKAL Petr
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Luanna > Dixson > Sent: Monday, January 23, 2017 6:39 PM > To: r-help@r-project.org > Subject: Re: [R] Suggestions for vectorizing/double loop > > Hi all, > > Thanks very much for your help! You are correct i

Re: [R] Suggestions for vectorizing/double loop

2017-01-23 Thread Luanna Dixson
Hi all, Thanks very much for your help! You are correct in thinking the list is the same as before, actually, my question was more about how to do the next steps, where I needed to match the filenames of the files in my directory with old (i.e current) and new file name prefixes in my list. For ea

Re: [R] Suggestions for vectorizing/double loop

2017-01-23 Thread PIKAL Petr
1:28 PM > To: r-help@r-project.org > Subject: [R] Suggestions for vectorizing/double loop > > I need to rename a bunch of files, by searching for string matches in a list. > Each list element containings a character with the old filename that I want to > match to, and the new fil

Re: [R] Suggestions for vectorizing/double loop

2017-01-23 Thread Michael Dewey
Dear Luanna It is not compulsory to avoid for loops but see below On 23/01/2017 12:28, Luanna Dixson wrote: I need to rename a bunch of files, by searching for string matches in a list. Each list element containings a character with the old filename that I want to match to, and the new file nam

Re: [R] Suggestions for vectorizing/double loop

2017-01-23 Thread Thierry Onkelinx
Dear Luanna, Assuming that oldnames and newnames are character (and not factor), the just use stringsAsFactors = FALSE. That will save you from having to convert the factors back to character. data.frame(oldnames, newnames, stringsAsFactor = FALSE) Best regards, ir. Thierry Onkelinx Instituut v

[R] Suggestions for vectorizing/double loop

2017-01-23 Thread Luanna Dixson
I need to rename a bunch of files, by searching for string matches in a list. Each list element containings a character with the old filename that I want to match to, and the new file name that I want to rename by. For instance, here filename '1001.xls' should match to list[[1]]$oldname and I want