[R] Help with "MERGE" gratefully accepted

Austin, Matt maustin at amgen.com
Fri Apr 15 04:14:48 CEST 2005


> dat1 <- data.frame(var1=c(140, 151, 167), var2=c(30.1, 11.4, 40))
> dat2 <- data.frame(var1=c(140, 167), var3=c(5.7, 30.3))
> merge(dat1, dat2, all=TRUE)
  var1 var2 var3
1  140 30.1  5.7
2  151 11.4   NA
3  167 40.0 30.3


Matt Austin
Statistician

Amgen 
One Amgen Center Drive
M/S 24-2-C
Thousand Oaks CA 93021
(805) 447 - 7431

"Today has the fatigue of a Friday and the desperation of a Monday"  -- S.
Pearce 2005


-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch]On Behalf Of Briggs, Meredith M
Sent: Thursday, April 14, 2005 18:26 PM
To: r-help at stat.math.ethz.ch
Subject: [R] Help with "MERGE" gratefully accepted






Hello

How do I use function 'MERGE" to combine the FILE A and FILE B below to make
FILE C?

Thank you



 FILE A      
	140        151        167        	
	30.1         11.4       40     

FILE B

      	140       167      	
	5.7	 30.3

FILE C

	140        151        167        	
	30.1         11.4      40   
	5.7	  NA	    30.3

______________________________________________
R-help at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html




More information about the R-help mailing list