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) ped<-mstrix(NA,nrow=10,ncol=3) for(i in 1:10){ Sire<- sample(sire[,1],1) a<- which(sire[,1]==Sire) if(a){sire[a,2]<-sire[a,2]+1}
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? sincerely firoozi Sent from my iPhone ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.