Re: [R] unique combinations

2011-12-22 Thread Jeff Newmiller
On Wed, 21 Dec 2011, Keith Jewell wrote: Thanks Uwe, I was happy that my 2 lines gave what the OP asked for, albeit in a different order. My puzzlement arose from Jeff Newmillers comment: You could read the help for expand.grid very carefully for the answer to this question. ... which I

[R] unique combinations

2011-12-21 Thread Antje Niederlein
Hi there, I have a vector and would like to create a data frame, which contains all unique combination of two elements, regardless of order. myVec - c(1,2,3) what expand.grid does: 1,1 1,2 1,3 2,1 2,2 2,3 3,1 3,2 3,3 what I would like to have 1,1 1,2 1,3 2,2 2,3 3,3 Can anybody help?

Re: [R] unique combinations

2011-12-21 Thread peter dalgaard
On Dec 21, 2011, at 08:59 , Antje Niederlein wrote: Hi there, I have a vector and would like to create a data frame, which contains all unique combination of two elements, regardless of order. myVec - c(1,2,3) what expand.grid does: 1,1 1,2 1,3 2,1 2,2 2,3 3,1 3,2 3,3

Re: [R] unique combinations

2011-12-21 Thread Jeff Newmiller
You could read the help for expand.grid very carefully for the answer to this question. --- Jeff NewmillerThe . . Go Live... DCN:jdnew...@dcn.davis.ca.usBasics: ##.#.

Re: [R] unique combinations

2011-12-21 Thread Keith Jewell
OK, someone point it out to me; my wife tells me I can't see what's in front of me :-} I read ?expand.grid carefully, went to ?combn and ?choose but still couldn't see an easy way to get what the OP asked for. The neatest I can get (which isn't very neat!) is: myVec - c(1,2,3) eg -

Re: [R] unique combinations

2011-12-21 Thread Uwe Ligges
On 21.12.2011 14:39, Keith Jewell wrote: OK, someone point it out to me; my wife tells me I can't see what's in front of me :-} I read ?expand.grid carefully, went to ?combn and ?choose but still couldn't see an easy way to get what the OP asked for. The neatest I can get (which isn't very

Re: [R] unique combinations

2011-12-21 Thread Keith Jewell
Thanks Uwe, I was happy that my 2 lines gave what the OP asked for, albeit in a different order. My puzzlement arose from Jeff Newmillers comment: You could read the help for expand.grid very carefully for the answer to this question. ... which I reas as saying that ?expand.grid would lead to