1
$\begingroup$

I'm studying agriculture and I'm looking for answers concerning one of my problem.

I have to implement a randomized complete block design and I would like to generate it with R.

I've found some answers in the pdf of the package named "agricolae". Nevertheless, I cannot manage to create it.

Does someone have an idea on how to do this please ?

I have 6 treatments and 4 blocks..

$\endgroup$

2 Answers 2

3
$\begingroup$

The agricolae package is useful for this task. In your case:

if(!require(agricolae)){install.packages("agricolae")}
library(agricolae)
treatment = letters[1:6]
design.rcbd(trt=treatment, r=4)
$\endgroup$
2
  • 1
    $\begingroup$ Thanks very much, that's exactly what I was looking for :) .. By the way, do you have any idea of how can I replace the letters I obtain (a, b, c, d, e, f) by either numbers (1 -> 6) or sentences/words such as Mod1, Mod2 -> Mod 6 ? $\endgroup$
    – Sophie
    Commented Jul 19, 2017 at 10:03
  • 1
    $\begingroup$ Yes, just replace the treatment = line. For numbered treatments: treatment = 1:6. For custom treatments: treatment = c("Control", "N only", "P only", "N and P only", "NPK", "NPK plus micro") $\endgroup$ Commented Jul 19, 2017 at 10:30
0
$\begingroup$

For an experiment it depends on what you want, do you want to analyze the data or setup the treatments into the blocks? I think you want the latter based on your question. To do this you need to allocate all 6 treatments once for each of the 4 blocks. To do this is R:

sample(1:6,size=6,replace=FALSE)

4 times to get the allocations for the 4 blocks. For me this gave:

sample(1:6,size=6,replace=FALSE)

[1] 6 3 4 1 5 2

sample(1:6,size=6,replace=FALSE)

[1] 5 2 4 6 3 1

sample(1:6,size=6,replace=FALSE)

[1] 2 6 3 1 5 4

sample(1:6,size=6,replace=FALSE)

[1] 3 6 2 1 4 5

These are the ways to allocate your treatments. Choose a numbering system for your treatments and you're good to go.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.