If you know how to merge 2 of the files together, then you can use the Reduce function to do the merging of multiple files.
You could use lapply to read all of the files into a list, then Reduce to merge them together, then output the result to a new file if a file is really what you want. Another approach may be to use one of the database packages and an sql query to merge everything together. Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] 801.408.8111 > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > project.org] On Behalf Of Ping-Hsun Hsieh > Sent: Monday, November 17, 2008 10:38 PM > To: r-help@r-project.org > Subject: [R] sequencially merge multiple files in a folder > > > > > Dear all, > > If the question is too easy, please forgive me since I am only few > weeks old in R. > > I have worked on this question a few days and still cannot figure it > out. > Here I have a folder with more than 50 tab-delimited files. Each file > has a few hundreds of thousands rows/subjects, and the number of > columns/variables of each file varies.The 1st row consists of all the > variable names. > > Now I would like to merge all the files into one tab-delimited file by > a common column named "Ident" > Is there any good way to sequencially merge all of them together? > Here when I say "sequencially" I mean merging file_1 and file_2 > first and then merge the resulting data frame and file_3, and keep > going on and on till all files are merged. > > If it is too complicated to do, merging all files together without the > specified order is also an acceptable alternative. > > Here I am using R version 2.7.2 (2008-08-25) and x86_64-unknown-linux- > gnu. > > Thank you for any advice and help! > > PingHsun ______________________________________________ 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.