samedi 27 janvier 2018

Constrained Randomization of data frame in R

I have a data frame like this :

 Tem    Time
 10a      1
 10a      2
 10a      3 
 10a      4 
 20a      1
 20a      2
 20a      3
 20a      4 
 #(10a and 10b are different treatment under the same Tem) 
 10b      1
 10b      2
 10b      3 
 10b      4 
 20b      1
 20b      2
 20b      3
 20b      4 

Now I want to do randomization to reduce experimental errors like this

 Tem     Time
 10a      1
 10a      2
 10a      3 
 10a      4 
 20a      4 #( not the same sequence for Time in 10a)
 20a      2
 20a      3
 20a      1 
 #(for b, not same sequence for a in Tem)
 20b      3
 20b      1
 20b      2
 20b      4 
 10b      1 #(not the same sequence for 20b)
 10b      3
 10b      2 
 10b      4 

At the end, I need to randomize all the 12 samples together. I know it is very complicated. Could you help me to do this or give me some hints? Thanks in advance!




Aucun commentaire:

Enregistrer un commentaire