[R] sequencially merge multiple files in a folder

Ping-Hsun Hsieh pinghsie at usc.edu
Tue Nov 18 06:37:39 CET 2008




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


More information about the R-help mailing list