Hi Jorge,
Thanks so much! Exactly what I wanted. Finally I wrote:
for(i in 1976:1981){
PE.files_01_7681 <- paste("val_mapped_petpe_", 1976:i, "01.txt", sep="")
}
Cheers,
Bea
On 21/04/2014 10:46, Jorge I Velez wrote:
> Hi Beatriz,
>
> Try
>
> paste("val_mapped_petpe_", 1976:1981, "01.txt", sep="")
>
> Best,
> Jorge.-
>
>
> On Mon, Apr 21, 2014 at 6:43 PM, Beatriz R. Gonzalez Dominguez
> <[email protected] <mailto:[email protected]>> wrote:
>
> Dear all,
>
> I'm trying to create a loop to select a series of files into my
> computer but I haven't been successful until now. I've looked into
> different possibilities but none has worked. I'd appretiate if you
> could help me by providing me with some ideas.
>
> Basically what I'd like to do is to create a character string
> variable [1:5], same as the one that could be obtained with
> 'list.files', but using a 'for' loop.
>
> This is one of the things I've tried but obviously doesn't yield
> the results I would like:
>
> for(i in 1976:1981){
> PE.files_01_7681 <- paste("val_mapped_petpe_", i, "01.txt", sep="")
> paste(PE.files_01_7681[i])
> }
>
> Many thanks!
>
> ______________________________________________
> [email protected] <mailto:[email protected]> mailing list
> 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.
>
>
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
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.