[R] permutations function
lamack lamack
lamac_k at hotmail.com
Sat Sep 20 16:26:30 CEST 2003
Dear all
If I consider
d<- c(1,2,3,4)
N<- 4
n<- 2
out1<- matrix(0,N^n,n)
z<-1
for(i in 1:N)
{
for(j in 1:N)
{
out1[z,1] = d[i]
out1[z,2] = d[j]
z<- z+1
}
}
library(gregmisc)
out2<- permutations(N,n,d,T,T)
I have that out1==out2. Ok
Now, if I consider
d<- c(1,2,3,4)
N<- 4
n<- 3
out1<- matrix(0,N^n,n)
z<-1
for(i in 1:N)
{
for(j in 1:N)
{
for(k in 1:N)
{
out1[z,1] = d[i]
out1[z,2] = d[j]
out1[z,3] = d[k]
z<- z+1
}
}
}
out2<- permutations(N,n,d,T,T)
I have that out1 is not equal out1.
My question is: Why out1 is not equal out2 ?
Best regards
More information about the R-help
mailing list