
Hello, 
I'm at an impasse in my coding and any help would be greatly appreciated. Below is my current code:
 
nr=dim(fileName)[1] #number of rows
count=0

for(i in 1:nr) {
for (j in 1:nr) {
if(fileName$Individual[i]==fileName$Individual[j] & i != j) #look for a pair in the column
{
count=count+1
perm<-sample(fileName$Group) #permutate sample group
if(count==1)break;
}

}
}


In the matrix (fileName), first it searches for a pair in column: Individual, and once identified it permutes another column (Group). 

I would like this process to repeat itself to produce all unique outputs for the perm variable. If each unique permutation had its own name or was in a matrix that would be very helpful. ie perm1: TCTTCT perm2: CTTTCT perm3: TCTTTC...


Hopefully that makes sense, thanks in advance group!
 		 	   		  
	[[alternative HTML version deleted]]

