Hi, Russell,

Here is a piece of code and you might need to tweak it a little.
MERGE 2 DATA FRAMES#######################################
# MERGE 2 DATA FRAMES:                #
# INNER JOIN, LEFT JOIN, RIGHT JOIN,  #
# FULL JOIN, & CARTESIAN PRODUCT      #
#######################################

data1<-data.frame(id1 = 1:10, x = rnorm(length(1:10)));
data2<-data.frame(id2 = seq(1, 20, by = 2), y = rnorm(length(seq(1, 20, by =
2))));

# INNER JOIN
inner.join<-merge(data1, data2, by.x = "id1", by.y = "id2");

# LEFT JOIN
left.join<-merge(data1, data2, by.x = "id1", by.y = "id2", all.x = TRUE);

# RIGHT JOIN
right.join<-merge(data1, data2, by.x = "id1", by.y = "id2", all.y = TRUE);

# FULL JOIN
full.join<-merge(data1, data2, by.x = "id1", by.y = "id2", all = TRUE);

# CARTESIAN PRODUCT
cartesian<-merge(data1, data2);



On 9/14/06, Geoff Russell <geoffrey.russell@gmail.com> wrote:
>
> I have a table:
>
>                          C1
> RowName1        3
> RowName2        2
>
> and another table:
>
>                           C2
> RowName1        5.6
> RowName1a      4.3
> RowName2        NA
>
> I want to join join the tables with matching rows:
>
>                           C1   C2
> RowName1         3    5.6
> RowName2        2     NA
>
> I'm thinking of something like:
>
> T1$C2=T2$C2[index-expression-to-pullout the matching ones]
>
> Any ideas would be appreciated.
>
> Cheers,
> Geoff Russell
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@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
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
WenSui Liu
(http://spaces.msn.com/statcompute/blog)
Senior Decision Support Analyst
Health Policy and Clinical Effectiveness
Cincinnati Children Hospital Medical Center

	[[alternative HTML version deleted]]

