[R] for loop

maryam firoozi firoozi_maryam6858 at yahoo.com
Tue Jan 12 06:53:06 CET 2016

Dear mr/madam
I want to mak a matrix with 10 row and 3 column . this matrix is pedigree. my input
sire<- c(1,2,3,4,5)
count<- 0
sire<- cbind(sire,count)
dam<- c(1,2,3,4,5,6,7,8,9,10)
for(i in 1:10){
Sire<- sample(sire[,1],1)
a<- which(sire[,1]==Sire)

Dam<- sample(dam,1)
ped[i,1]<- 1:10
ped[i,2]<- Sire
ped[i,3]<- Dam}
i cant write a code that each sire use only twic not more in ped and Dam use only once.
can you help me?
Sent from my iPhone

More information about the R-help mailing list