Skip to content

Commit

Permalink
Fixing up wholeplot column in split plot designs
Browse files Browse the repository at this point in the history
  • Loading branch information
rogerssam committed Aug 9, 2024
1 parent 5734000 commit 0607d06
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 14 deletions.
10 changes: 8 additions & 2 deletions R/des_info.R
Original file line number Diff line number Diff line change
Expand Up @@ -439,17 +439,23 @@ des_info <- function(design.obj,

if(design == "split") {
des <- design.obj$book

numsp <- max(as.numeric(des$splots))
lenblk <- as.vector(table(des$block)[1])
numwp <- lenblk/numsp
des$wplots <- rep(rep(1:numwp, each = numsp), max(as.numeric(des$block)))
des <- des[, c(1, 3, 6, 2, 4, 5)]

spfacs <- c("plots", "block", "wplots", "splots")

trtNams <- names(des[!is.element(names(des), spfacs)])

design.obj$book <- des

des$treatments <- factor(paste(des[, trtNams[1]], des[, trtNams[2]], sep = "_"))

# Number of treatments
ntrt <- nlevels(des$treatments)


# Calculate direction of blocking
xx <- c()
rr <- nrows / brows
Expand Down
5 changes: 0 additions & 5 deletions R/design.R
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,6 @@ design <- function(type,
trt2 = sub_treatments,
r = reps,
seed = ifelse(is.numeric(seed), seed, 0))
numsp <- max(as.numeric(outdesign$book$splots))
lenblk <- as.vector(table(outdesign$book$block)[1])
numwp <- lenblk/numsp
outdesign$book$wplots <- rep(rep(1:numwp, each = numsp), reps)
outdesign$book <- outdesign$book[, c(1, 3, 6, 2, 4, 5)]
}

else if(substr(tolower(type), 1, 7) == "crossed") {
Expand Down
6 changes: 3 additions & 3 deletions R/satab.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#' Produces a skeletal ANOVA table
#'
#' @param design.obj An `agricolae` design object.
#' @param design.obj A modified `agricolae` design object as output from des_info.
#'
#' @return Prints skeletal ANOVA table to console output.
#'
Expand Down Expand Up @@ -112,12 +112,12 @@ satab <- function(design.obj) {
blkdf <- length(unique(design.obj$block)) - 1
totdf <- nrow(design.obj) - 1
numwplots <- nrow(design.obj) / length(unique(design.obj$splots))
sp.facWdf <- length(unique(design.obj[, 5])) - 1
wpresdf <- (numwplots - 1) - blkdf - sp.facWdf

trtAdf <- length(unique(design.obj[, 5])) - 1
trtBdf <- length(unique(design.obj[, 6])) - 1
trtABdf <- trtAdf * trtBdf

wpresdf <- (numwplots - 1) - blkdf - trtAdf
errdf <- totdf - trtAdf - trtBdf - trtABdf - blkdf - wpresdf

output <- paste0(format("Source of Variation", width = 45), "df", "\n")
Expand Down
14 changes: 11 additions & 3 deletions man/multiple_comparisons.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/satab.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0607d06

Please sign in to comment.