Since the date columns have different names, you need to specify the
by.x and by.y arguments to merge().

Other than that, it should work.

If you need more help, please use dput() to provide some of your data,
and include both the code you used and the error message or incorrect
result you got (that is, a reproducible example). And also, post this
information in plain text rather than HTML.

Sarah

On Tue, Jan 5, 2016 at 1:19 AM,  <santosh.ar...@csiro.au> wrote:
> 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.ar...@csiro.au<mailto:santosh.ar...@csiro.au>
>
>
>

-- 
Sarah Goslee
http://www.numberwright.com

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.

Reply via email to