library(agricolae)
# 5 treatments and 6 blocks
trt<-c("A","B","C","D","E")
rcbd <-design.rcbd(trt,6,number=101,986,"Wichmann-Hill") # seed = 986
rcbd # field book
# write in hard disk
# write.table(rcbd,"rcbd.txt", row.names=FALSE, sep="\t")
# file.show("rcbd.txt")
# Plots in field model ZIGZAG
plots <-as.numeric(rcbd[,1])
block<- as.numeric(rcbd[,2])
trt <-as.character(rcbd[,3])
nplots<- length(plots)
nblock<- nlevels(rcbd[,2])
ntrt<- nlevels(rcbd[,3])
indice<-1:nplots
for (i in 1:nplots){
if ( 2*floor(block[i]/2) == block[i])indice[i]<-2*block[i]*ntrt-i-ntrt+1
}
plots<-plots[indice]
trt<-trt[indice]
dim(plots)<-c(ntrt,nblock)
dim(trt)<-c(ntrt,nblock)
print(t(plots))
print(t(trt))
Run the code above in your browser using DataLab