So I needed to merge 17 .csv files, and did so by brute force, but I might
need to do so again. Anyone have suggestions for a for loop that might do
the below for me (where a:r are separate .csv files)

ab<-merge(a,b,all=TRUE)
cd<-merge(c,d,all=TRUE)
ef<-merge(e,f,all=TRUE)
gh<-merge(g,h,all=TRUE)
ij<-merge(i,j,all=TRUE)
kl<-merge(k,l,all=TRUE)
no<-merge(m,n,all=TRUE)
pq<-merge(p,q,all=TRUE)
abcd<-merge(ab,cd,all=TRUE)
efgh<-merge(ef,gh,all=TRUE)
ijkl<-merge(ij,kl,all=TRUE)
nopq<-merge(no,pq,all=TRUE)
ah<-merge(abcd,efgh,all=TRUE)
iq<-merge(ijkl,nopq,all=TRUE)
aq<-merge(ah,iq,all=TRUE)
all<-merge(aq,r,all=TRUE)

write.csv(all,file="all.merged.csv")

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org 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.

Reply via email to