[R] Merging two data files based on common dates

Santosh.Aryal at csiro.au Santosh.Aryal at csiro.au
Tue Jan 5 07:19:26 CET 2016


Hello there
Pardon my ignorance but, I have two data files with different series of dates and x and y values.
There are common dates in both files. For example
>datafile1
date1                     xval
31/12/1982         20
1/01/1983            30
2/01/1983            40
3/01/1983            50
4/01/1983            60
5/01/1983          70
...
01/01/2010       77
...
31/12/1012       99

>datafile2
date2                  yval
3/01/1983            0.4
4/01/1983            0.5
5/01/1983            0.6
..
01/01/2010        88

All I want is a file/object that merges the two files with data for common dates to look like this.
date                    yval  xval
3/01/1983            0.4  50
4/01/1983            0.5  60
5/01/1983            0.6  70
..
01/01/2010        88     77

I tried ' merge' and ' join' commands but somehow I have not been able to get that. Any help will be appreciated.
Thank you.


Best regards

Santosh Aryal
CSIRO Land and Water
GPO Box 1666, Canberra ACT 2601
Ph:   02 6246 5963
Email: santosh.aryal at csiro.au<mailto:santosh.aryal at csiro.au>







	[[alternative HTML version deleted]]



More information about the R-help mailing list