Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output suggestion for replications #3

Closed
Prof-ThiagoOliveira opened this issue Mar 19, 2021 · 3 comments
Closed

Output suggestion for replications #3

Prof-ThiagoOliveira opened this issue Mar 19, 2021 · 3 comments

Comments

@Prof-ThiagoOliveira
Copy link

Prof-ThiagoOliveira commented Mar 19, 2021

Hi,

I am really enjoying the package, and I would like to congratulate all authors on their work. This package has many ideas I had a few years ago; however, with several improvements and covering several experimental designs.

My suggestion here is minimal but can contribute to the output of some functions you have there. I think you should be more explicitly when reporting replication in your output, e.g., function latin_square() has the following output:

R> latin_data <- data.frame(list(ROW = paste("Period", 1:5, sep = ""),
+                                                COLUMN = paste("Cow", 1:5, sep = ""),
+                                                TREATMENT = paste("Diet", 1:5, sep = "")))
R> latinSq2 <- latin_square(t = NULL, 
+                                          reps = 2, 
+                                          plotNumber = 101, 
+                                          planter = "cartesian",
+                                          seed = 1981, 
+                                          data = latin_data)
R> print(latinSq2)

$squares
$squares[[1]]
        Cow1    Cow2    Cow3    Cow4    Cow5   
Period1 "Diet4" "Diet3" "Diet2" "Diet1" "Diet5"
Period2 "Diet1" "Diet2" "Diet4" "Diet5" "Diet3"
Period3 "Diet3" "Diet5" "Diet1" "Diet2" "Diet4"
Period4 "Diet2" "Diet4" "Diet5" "Diet3" "Diet1"
Period5 "Diet5" "Diet1" "Diet3" "Diet4" "Diet2"

$squares[[2]]
        Cow1    Cow2    Cow3    Cow4    Cow5   
Period1 "Diet2" "Diet4" "Diet5" "Diet3" "Diet1"
Period2 "Diet1" "Diet2" "Diet3" "Diet4" "Diet5"
Period3 "Diet3" "Diet5" "Diet1" "Diet2" "Diet4"
Period4 "Diet4" "Diet1" "Diet2" "Diet5" "Diet3"
Period5 "Diet5" "Diet3" "Diet4" "Diet1" "Diet2"


$plotSquares
$plotSquares[[1]]
     [,1] [,2] [,3] [,4] [,5]
[1,]  101  102  103  104  105
[2,]  106  107  108  109  110
[3,]  111  112  113  114  115
[4,]  116  117  118  119  120
[5,]  121  122  123  124  125

$plotSquares[[2]]
     [,1] [,2] [,3] [,4] [,5]
[1,]  201  202  203  204  205
[2,]  206  207  208  209  210
[3,]  211  212  213  214  215
[4,]  216  217  218  219  220
[5,]  221  222  223  224  225

...

In this case, replication output has been reported as list numbers. I think should be useful for end-users to see these numbers actually representing replication numbers. Thus, I did a modification in your function latin_square() including this information in the output, where the results now is reported as:

$squares$rep1
        Cow1    Cow2    Cow3    Cow4    Cow5   
Period1 "Diet4" "Diet3" "Diet2" "Diet1" "Diet5"
Period2 "Diet1" "Diet2" "Diet4" "Diet5" "Diet3"
Period3 "Diet3" "Diet5" "Diet1" "Diet2" "Diet4"
Period4 "Diet2" "Diet4" "Diet5" "Diet3" "Diet1"
Period5 "Diet5" "Diet1" "Diet3" "Diet4" "Diet2"

$squares$rep2
        Cow1    Cow2    Cow3    Cow4    Cow5   
Period1 "Diet2" "Diet4" "Diet5" "Diet3" "Diet1"
Period2 "Diet1" "Diet2" "Diet3" "Diet4" "Diet5"
Period3 "Diet3" "Diet5" "Diet1" "Diet2" "Diet4"
Period4 "Diet4" "Diet1" "Diet2" "Diet5" "Diet3"
Period5 "Diet5" "Diet3" "Diet4" "Diet1" "Diet2"


$plotSquares
$plotSquares$rep1
     [,1] [,2] [,3] [,4] [,5]
[1,]  101  102  103  104  105
[2,]  106  107  108  109  110
[3,]  111  112  113  114  115
[4,]  116  117  118  119  120
[5,]  121  122  123  124  125

$plotSquares$rep2
     [,1] [,2] [,3] [,4] [,5]
[1,]  201  202  203  204  205
[2,]  206  207  208  209  210
[3,]  211  212  213  214  215
[4,]  216  217  218  219  220
[5,]  221  222  223  224  225

...

What do you think about including this modification in other functions you have?

Here is the raw code I've included:

latin_square <- function(t = NULL, reps = 1, plotNumber = 101,  planter = "serpentine",
                         seed = NULL, locationNames = NULL, data = NULL) {
 ...
  # line 106----------------------------------------------------------
  plotSquares <- setNames(vector(mode = "list", length = reps),
                          paste0("rep", seq(1:reps))) # set names
  #line 152-----------------------------------------------------------
  ...
  #---------------------------------------------------------------------
  lsd.reps <- setNames(lsd.reps, paste0("rep", seq(1:reps))) # set names
  #---------------------------------------------------------------------
  ...
  return(list(squares = lsd.reps, plotSquares = plotSquares,
              fieldBook = latin_design))
}
@DidierMurilloF
Copy link
Owner

Dear ThiagoOliveira,

Thank you for all the suggestions, they are great we will include them in the package as suggested by you. Thank you very much for your time and consideration.

@DidierMurilloF
Copy link
Owner

Dear Profesor Thiago,

I got your suggestion about the outputs for replications. I did it on some designs that involve those kinds of outputs. For example, we say a row-column design with 30 treatments, 5 rows, 3 reps across two locations.

rowcold1 <- row_column(t = 30, nrows = 5, r = 3, l = 2, 
                       plotNumber= c(101, 1001), 
                       locationNames = c("FARGO", "NELSON"),
                       seed = 1201)
rowcold1$infoDesign
rowcold1$resolvableBlocks
head(rowcold1$fieldBook, 12)

The output for this design looks like,

> rowcold1 <- row_column(t = 30, nrows = 5, r = 3, l = 2, 
+                        plotNumber= c(101, 1001), 
+                        locationNames = c("FARGO", "NELSON"),
+                        seed = 1201)
> rowcold1$infoDesign
$nRows
[1] 5

$nCols
[1] 6

$Reps
[1] 3

$NumberTreatments
[1] 30

$NumberLocations
[1] 2

$Locations
[1] "FARGO"  "NELSON"

$seed
[1] 1201

> rowcold1$resolvableBlocks
$Loc_FARGO
$Loc_FARGO$rep1
     [,1] [,2] [,3] [,4] [,5] [,6]
[1,]   11   18   12    6   15    3
[2,]   27    9   24   13   20    1
[3,]    2    4   14   28   21   23
[4,]   22   29   26   30    7   25
[5,]   16    5    8   19   10   17

$Loc_FARGO$rep2
     [,1] [,2] [,3] [,4] [,5] [,6]
[1,]   14   18    2   12    8   28
[2,]   17   22   26   21   15   25
[3,]   20    3   10    1    6   24
[4,]   30   19   23   16    5    4
[5,]   29    7    9   13   11   27

$Loc_FARGO$rep3
     [,1] [,2] [,3] [,4] [,5] [,6]
[1,]   18   13    9    1   30   12
[2,]   28   10   20   22   11    6
[3,]   21    5   19   14   25   29
[4,]    8   27   16    4   26    2
[5,]   23   17   24   15    7    3


$Loc_NELSON
$Loc_NELSON$rep1
     [,1] [,2] [,3] [,4] [,5] [,6]
[1,]   25   20   22   21   24    5
[2,]   19   30   17   29   16    8
[3,]   12   15   27   23    3   10
[4,]    4   18   28   26    2    6
[5,]   13    1   11    7    9   14

$Loc_NELSON$rep2
     [,1] [,2] [,3] [,4] [,5] [,6]
[1,]   13   16   14    8    2   10
[2,]    3   28   11   26    1    9
[3,]   17    6   24    4   12   27
[4,]   15   18   29   22   23   19
[5,]   21   25   30   20    5    7

$Loc_NELSON$rep3
     [,1] [,2] [,3] [,4] [,5] [,6]
[1,]   17    4   27   10   18   14
[2,]   12   30    6   21    5   22
[3,]   16   23    2   20    7    3
[4,]    8    9   15   25   11    1
[5,]   29   28   26   24   13   19


> head(rowcold1$fieldBook, 12)
   ID LOCATION PLOT REP ROW COLUMN ENTRY
1   1    FARGO  101   1   1      1    11
2   2    FARGO  102   1   1      2    18
3   3    FARGO  103   1   1      3    12
4   4    FARGO  104   1   1      4     6
5   5    FARGO  105   1   1      5    15
6   6    FARGO  106   1   1      6     3
7   7    FARGO  107   1   2      1    27
8   8    FARGO  108   1   2      2     9
9   9    FARGO  109   1   2      3    24
10 10    FARGO  110   1   2      4    13
11 11    FARGO  111   1   2      5    20
12 12    FARGO  112   1   2      6     1

Thank you for the suggestion, I think the output is more comprehensible right now. Please, let me know if you have any questions. Thank you!!

Didier Murillo.

@Prof-ThiagoOliveira
Copy link
Author

Thanks for this update @DidierMurilloF

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants