Hellooo!
For the last couple of weeks, I have been learning to write some R functions for simple biological systems simulations. Well, I haven't been that successful in that venture, but I surely learned some pretty useful things that we can do in R w/o spending much time and brain.
Generating the plot map in a completely randomized desine.
I think experimental designs are the inextricably related with most agricultural studies. So, at least for me, knowing this code will make my work a bit easier in future.
Here is a code that generates a randomized treatment map for a CRD experiment
> no.treat<- ntrt<- 6
> no.repln<- nrepl<- 4
> trt.samples<- sample(rep(x = 1:no.treat, times = no.repln))
# This will generate random sampls for all the 6 treatments and repeat this for all the 6 replications.
> trt.map<- matrix(trt.samples, nrow = no.repln, ncol = no.treat)
# This will create a matrix of the random samples which is also the plot map of the experiment.
which looks like as follows
> trt.map
[,1] [,2] [,3] [,4] [,5] [,6]
[1,] 5 1 6 6 5 3
[2,] 2 3 6 2 4 4
[3,] 4 3 2 1 2 5
[4,] 4 1 6 5 1 3
>
This is pretty easy, isn't it.
2 comments:
Could u go further and include other designs
I guess it is extremely late for reply. Sure, I could, I will definitely do that when I encounter that problem.
Coz, here we are posting the things we do out of necessity.Right?
So,that will definitely come during our research.
Post a Comment