[R] loop with files

Alfredo Alessandrini alfreale74 at gmail.com
Tue Jun 24 11:33:48 CEST 2008


I'm trying to make a loop with many files...


> library(dplR)
>
> files <- system("ls *.rwl", intern=TRUE)
>
> files
[1] "cimfasy.rwl" "rocquce.rwl"
> for (i in files) {a <- read.rwl(i,header=0)}
There are 70 series
There are 21 series
> class(a)
[1] "data.frame"


This loop import all the files rwl in a single data.frame ( a ).

Can I import a single files to a single data.frame? like this:

for (i in files) {cimfasy <- read.rwl(i,header=0)}

for (i in files) {rocquce <- read.rwl(i,header=0)}



Thanks in advance,
Alfredo



More information about the R-help mailing list