Last active
October 16, 2016 08:16
-
-
Save sithjaisong/0e97f9aeedd6836e6438e3188240e357 to your computer and use it in GitHub Desktop.
plot.CRD.layout function: the function for generate completely radomized design
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(agricolae) | |
library(desplot) | |
plot.CRD.layout <- function(trt_name, num_rep){ | |
repeticion <- rep(num_rep, length(trt)) | |
CRD <- design.crd(trt, r = repeticion, serie = 0) | |
CRD_layout <- CRD$book | |
CRD_layout$block <- "B1" | |
CRD_layout$x <- rep(1:num_rep, each = length(trt_name)) | |
CRD_layout$y <- rep(1:length(trt), num_rep) | |
CRD_layout$trt <- sample(as.character(as.factor(CRD_layout$trt_name))) | |
plot_crd <- desplot(data = CRD_layout, block ~ x + y, text = trt, show.key = FALSE, cex = 2) | |
plot(plot_crd) | |
} | |
# example | |
# plot.CRD.layout(trt_name = c("A", "B"), num_rep = 3) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment