[R] How to read several text files at once!

Faramarzi Monireh monireh.faramarzi at env.ethz.ch
Wed May 9 10:03:45 CEST 2007

Dear R users,
I am a beginner in R. I have 506 text files (data frame) in one folder namely DATA. The files are called A1 to A253 (253 files) and B1 to B253 (another 253 files). Each file has two columns; V1 (row number)
and V2 (the value for each row name). Now I would like to add the values of
V2 in each A-file with its relative value in B-file and save it as a
new data frame named as C (e.g. C1 with V1 (row number) and V2
(A1$V2+B1$V2) ). Therefore, at the end I will have 253 C files 
(C1 to C253). I also would like to sum a number of the C files with each other (e.g. C1+ C2+ 
+C50) and save as a new file like C_sum.

I already tried to write a short script to do all together but it did not
work. I only was able to do for each C file separately. The main problem
is that I do not know how to read several text files and how to use those
files to make C files and afterwards C-sum files. I would be gratful if somebody can help me to write a short script to do all together.
Thank you very much in advance for your cooperation,

More information about the R-help mailing list