Dear all:
This is one of those should be easy problems that I'm having great difficulty
solving. I have a vector containing ID codes, and I need to generate a 3-column
matrix that contains all possible combinations of three.
For example, my ID vector looks like this:
A
B
C
D
E
I need to
On Tue, Dec 2, 2008 at 7:42 PM, philozine [EMAIL PROTECTED] wrote:
Dear all:
This is one of those should be easy problems that I'm having great
difficulty solving. I have a vector containing ID codes, and I need to
generate a 3-column matrix that contains all possible combinations of three.
Dear Brandon,
On Tue, Dec 2, 2008 at 10:46 PM, Dylan Beaudette
[EMAIL PROTECTED] wrote:
On Tue, Dec 2, 2008 at 7:42 PM, philozine [EMAIL PROTECTED] wrote:
Dear all:
This is one of those should be easy problems that I'm having great
difficulty solving. I have a vector containing ID codes,
However, I believe Brandon was trying to get the permutations of size
3, rather than combinations. Dylan provided a solution including
repeats. Here's one without:
library(gtools)
permutations(5, 3, LETTERS[1:5])
[,1] [,2] [,3]
[1,] A B C
[2,] A B D
[3,] A B E
[4,] A C B
Dear Kingsford,
You are quite right, my mistake:
urnsamples(ID, size = 3, replace = FALSE, ordered = TRUE)
Thanks.
Jay
On Wed, Dec 3, 2008 at 12:04 AM, Kingsford Jones
[EMAIL PROTECTED] wrote:
However, I believe Brandon was trying to get the permutations of size
3, rather than combinations.
Dear all:
These solutions work beautifully. Many, many thanks. And apologies for my lazy
language! I did indeed mean permutations
Best regards,
Brandon
--- On Wed, 12/3/08, G. Jay Kerns [EMAIL PROTECTED] wrote:
From: G. Jay Kerns [EMAIL PROTECTED]
Subject: Re: [R] Create unique sets
6 matches
Mail list logo