Hi Haris,
On Thursday 15 November 2007, Charilaos Skiadas wrote:
I must be missing something. What's wrong with:
combn(set, 2)
or if we must t(combn(set,2)), optionally with a function argument in
the combn call if something is to be done with the pairs?
So if you really wanted the
On Friday 16 November 2007, Peter Dalgaard wrote:
[...]
Or even (from someone who have known about combn for a while)
combn(LETTERS[1:7], 2, paste, collapse=)
[1] AB AC AD AE AF AG BC BD BE BF BG CD CE
CF CG
[16] DE DF DG EF EG FG
Chapeau...
Adrian
--
Adrian Dusa
Romanian Social
Adrian Dusa wrote:
On Thursday 15 November 2007, [EMAIL PROTECTED] wrote:
Actually, (now that I know about combn), a better way is
t(matrix(set[combn(7,2)], nrow = 2))
Indeed, or to avoid transposing:
matrix(set[combn(7,2)], ncol = 2, byrow=T)
Adrian
Or even (from someone
]
project.org]
On Behalf Of [EMAIL PROTECTED]
Sent: Thursday, 15 November 2007 2:51 PM
To: r-help@r-project.org
Subject: [R] generate combination set
I have a set data={A,B,C,D,E,F,G}
I want to choose 2 letter from 8 letters, i.e. generate the
combination
set
for choose 2 letters from 8
-project.org
Subject: Re: [R] generate combination set
Using your set, wouldn't it be simpler like this?
t(apply(combn(7,2), 2, function(x) set[x]))
Hth,
Adrian
On Thursday 15 November 2007, [EMAIL PROTECTED] wrote:
There are a number of packages that do this, but here is a simple
function for choosing
On Thursday 15 November 2007, [EMAIL PROTECTED] wrote:
Actually, (now that I know about combn), a better way is
t(matrix(set[combn(7,2)], nrow = 2))
Indeed, or to avoid transposing:
matrix(set[combn(7,2)], ncol = 2, byrow=T)
Adrian
--
Adrian Dusa
Romanian Social Data Archive
1, Schitu
I have a set data={A,B,C,D,E,F,G}
I want to choose 2 letter from 8 letters, i.e. generate the combination set
for choose 2 letters from 8 letters.
I want to get the liking:
combination set={AB,AC,AD,}
Does anyone konw how to do in R.
thanks,
Aimin
7 matches
Mail list logo