[R] how to keep keep matching column in output of merge

2011-01-04 Thread Nevil Amos

How do I keep the linking column[s] in a merge()?
 I need to use the values again in a further merge.

thanks

Nevil Amos

__
R-help@r-project.org 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.


Re: [R] how to keep keep matching column in output of merge

2011-01-04 Thread Ben Bolker
Nevil Amos nevil.amos at gmail.com writes:

 How do I keep the linking column[s] in a merge()?
   I need to use the values again in a further merge.

  simple reproducible example please?
(e.g. make up a couple of 4-row datasets that show what you
want, what you are trying, and what you are getting instead).

__
R-help@r-project.org 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.


Re: [R] how to keep keep matching column in output of merge

2011-01-04 Thread Sarah Goslee
Hi Nevil,

We really need an example here of what you're doing, since
merge() does keep the id column by default.


 x - data.frame(id = c(a, b, c, d), x=c(1,2,3,4))
 y - data.frame(id = c(b, a, d, c), y=c(101, 102, 103, 104))
 merge(x, y)
  id x   y
1  a 1 102
2  b 2 101
3  c 3 104
4  d 4 103

Sarah

On Tue, Jan 4, 2011 at 8:31 AM, Nevil Amos nevil.a...@gmail.com wrote:
 How do I keep the linking column[s] in a merge()?
  I need to use the values again in a further merge.

 thanks

 Nevil Amos


-- 
Sarah Goslee
http://www.functionaldiversity.org

__
R-help@r-project.org 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.


Re: [R] how to keep keep matching column in output of merge

2011-01-04 Thread Nevil Amos

Apologies,  it is there!

On 5/01/2011 1:26 AM, Sarah Goslee wrote:

Hi Nevil,

We really need an example here of what you're doing, since
merge() does keep the id column by default.



x- data.frame(id = c(a, b, c, NA), x=c(1,2,3,4))
y- data.frame(id1 = c(NA, a, d, c), y=c(101, 102, 103, 104))
merge(x, y)

   id x   y
1  a 1 102
2  b 2 101
3  c 3 104
4  d 4 103

Sarah

On Tue, Jan 4, 2011 at 8:31 AM, Nevil Amosnevil.a...@gmail.com  wrote:

How do I keep the linking column[s] in a merge()?
  I need to use the values again in a further merge.

thanks

Nevil Amos



__
R-help@r-project.org 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.