Hi all,

I'm just a beginner with R but I have not been able to search for any
relevant answer to my problem.  I apologize if it has in fact been asked
before.

Recently I've realized that I need to combine hundreds of pairs of data
frames.  The filenames of the frames I need to combine have unique strings.
 This is my best guess as to the approach to take:

 filenames<-list.files()

filenames
[1] "a1.csv" "a2.csv" "b1.csv" "b2.csv" "c1.csv" "c2.csv"

alldata<-lapply(filenames, read.csv, header=TRUE)

 names(alldata)<-filenames
 summary(alldata)
       Length Class      Mode
a1.csv 27     data.frame list
a2.csv 27     data.frame list
b1.csv 27     data.frame list
b2.csv 27     data.frame list
c1.csv 27     data.frame list
c2.csv 27     data.frame list

My next step would be to cbind files that share a common string at the
beginning, such as:
cbind(alldata[[1]],alldata[[2]])
cbind(alldata[[3]],alldata[[4]])
cbind(alldata[[5]],alldata[[6]])
...

but file list is hundreds of files long (but is sorted alphanumerically
such as in this example - not sure if this is relevant).  If I had to
guess, I'd do something like this:

which(names(alldata)==...), to identify which elements to combine based on
unique filename

OR
x<-seq(1,length(alldata), 2)
y=x+1
z<-cbind(x,y)
z
     x y
[1,] 1 2
[2,] 3 4
[3,] 5 6

to use the frame created in z to combine based on rows,

then use a looped cbind function (or *apply function with nested cbind
function?) using the previously returned indexes to create my new combined
data frames, including a step to write the frames to a new unique filename
(not sure how to do that step in this context).  These last steps I've
tried a lot of code but nothing worth mentioning as it has all failed
miserably.

I appreciate the help,

M

	[[alternative HTML version deleted]]

