RE: [R] reading multiple files

From: bogdan romocea <>
Date: Wed 25 May 2005 - 01:47:01 EST

You're almost there, use a list:
myfiles <- list()
for (i in 1:n) myfiles[[i]] <- etc
You can then get at your data frames with myfiles[[1]], myfiles[[2]]... Or, if you prefer to combine them into a single data frame (assuming they're similar),
allmyfiles <-"rbind",myfiles)

-----Original Message-----
From: Dave Evens [] Sent: Tuesday, May 24, 2005 11:10 AM
Subject: [R] reading multiple files

Dear All,

How do I read in multiple data frames or matrices in a loop, e.g.

for (i in 1:n) {

   channel <- odbcConnectExcel("filenames")    file[i] <-, "sheet"))

I would like file[i] to be the name of the data.frame (i.e. file[1], file[2], file[3],...etc) rather than a vector.

Thanks in advance for any help.

Dave mailing list PLEASE do read the posting guide! mailing list PLEASE do read the posting guide! Received on Wed May 25 01:53:05 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:32:01 EST