[R] Combining files

Jean-Pierre Gattuso gattuso at obs-vlfr.fr
Wed Jan 2 19:01:50 CET 2002


Hi:

I am a very recent user of R 1.40 for MacOSX and went through the 
help files but did not not find the function that I am looking for.


I have two comma separated files which I want to partly combine.

File 1 has 49670 lines and 26 columns (separated by commas) and looks 
like this:

...
86020,-10.25,30.25,19.24,19.18,6.19,22.6,16.41,.4,1.58,36.36,36.47,36.18,,3,3,4,116.44,3.03,98.83,126.97,116.03,5.44,0,0,-1
86021,-9.75,30.25,19.06,18.97,6.24,22.41,16.17,.42,1.58,36.36,36.47,36.18,.01,3,3,4,146.15,5.33,131.7,153.38,145.6,9.46,0,0,-1
86022,-9.25,30.25,,,,,,,,,,,,3,,,,,,,,,0,0,-1
86023,-8.75,30.25,,,,,,,,,,,,,,,,,,,,,0,0,-1
86071,15.25,30.25,,,,,,,,,,,,3,,,,,,,,,0,0,-1
....

File 2 has 259201 lines and 8 columns (separated by commas) and looks 
like this:

...
86020,Oceanic I,-1,-10.25,30.25,7,2670.172,207.249
86021,Coastal,0,-9.75,30.25,7,2670.172,207.249
86022,Terrestrial,1,-9.25,30.25,7,2670.172,207.249
86023,Terrestrial,1,-8.75,30.25,7,2670.172,207.249
86024,Not Selected,-9999,-8.25,30.25,7,2670.172,207.249
...

Column 1 in both files is the cell id and colum 2 in file 2 provides 
the nature of the cell (oceanic, terrestrial...).

What I want to do is to add the nature of the cell to each line of 
file 1. In other words, I want to add column 2 of file 2 (e.g. 
"oceanic") to file 1, using columns 1 of both files as matching 
variables (i.e. add column 2 o

Thanks in advance for your help,
jp
-- 

____________________________________________________________________
Jean-Pierre Gattuso
Laboratoire d'Océanographie de Villefranche, UMR 7093 CNRS-UPMC
B. P. 28, F-06234 Villefranche-sur-mer Cedex - France
Voice: +33 (0)493763859 - Fax: +33 (0)493763834 - US fax: +1 (978) 477-8302
<mailto:gattuso at obs-vlfr.fr> - http://www.obs-vlfr.fr/~gattuso
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list