[R] Question about merge()

Jonathan Greenberg jgreenberg at arc.nasa.gov
Sun Sep 24 00:08:22 CEST 2006


If I want to do a join based on *two* matching fields in two data frames,
can merge() handle this?  It appears to only handle a single matching column
-- do I need to make a "metacolumn" or is there some way to do this?  E.g.:

Dataframe 1 contains columns A,B,C and Dataframe 2 contains A,B,D

I want an output A,B,C,D which places C and D together if A and B match
(otherwise, make two new rows, e.g. Ax,Bx,Cx,nodata and Ay,By,nodata,Dy)

--j

-- 
Jonathan A. Greenberg, PhD
NRC Research Associate
NASA Ames Research Center
MS 242-4
Moffett Field, CA 94035-1000
Office: 650-604-5896
Cell: 415-794-5043
AIM: jgrn307
MSN: jgrn307 at hotmail.com



More information about the R-help mailing list