[R] Merging data

2006-02-22 Thread Brian Perron
Hello all, I am fairly new to R and am trying to bring together data from multiple sources. Here is one problem that I cannot seem to crack – I hope somebody can help. Let me simplify the problem: Let’s say I have two datasets: DATA1 and DATA2. I would like to work with all the cases in

Re: [R] Merging data

2006-02-22 Thread Chuck Cleland
Brian Perron wrote: Hello all, I am fairly new to R and am trying to bring together data from multiple sources. Here is one problem that I cannot seem to crack – I hope somebody can help. Let me simplify the problem: Let’s say I have two datasets: DATA1 and DATA2. I would like to

Re: [R] Merging data

2006-02-22 Thread Liaw, Andy
Something like this? data1 - data.frame(id=c(1, 3, 5), x=runif(3)) data2 - data.frame(id=1:10, y=runif(10)) data3 - merge(data1, data2, by=id, all.x=TRUE, all.y=FALSE) data3 id x y 1 1 0.9533341 0.1803271 2 3 0.9143624 0.5033228 3 5 0.2866931 0.4233733 Andy From: Brian