## setup framework for blocks and treatments Chemical_type<-c(rep("1",4),rep("2",4),rep("3",4),rep("4",4)) Bolt<-c(rep(c("O1","O2","O3","O4"),4)) ##Assign data to variable "strength" strength<-c(73,68,71,67,73,67,72,70,75,68,73,68,73,71,75,69) y<-data.frame(Chemical_type,Bolt,strength) matrix(y$Bolt,4,byrow = T) matrix(y$strength,4,4,byrow = T) ## Apply a linear model yfit<-lm(strength~Bolt+Chemical_type,y) ## Compute the analysis of variance table anova(yfit)