Skip to content

Commit

Permalink
Change column names in split plot designs
Browse files Browse the repository at this point in the history
  • Loading branch information
rogerssam committed Aug 27, 2024
1 parent 1015a64 commit f37be70
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
2 changes: 2 additions & 0 deletions R/des_info.R
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,8 @@ des_info <- function(design.obj,
plan$block <- NULL
} # 5

colnames(des)[colnames(des)=="wplots"] <- "wholeplots"
colnames(des)[colnames(des)=="splots"] <- "subplots"
des <- cbind(plan, des)
# Order by column within blocks, rather than row default
if(!byrow) {
Expand Down
1 change: 1 addition & 0 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ min.r <- substr(description[,"Depends"], 7, 11)
[![minimal R version](https://img.shields.io/badge/R%3E%3D-`r min.r`-6666ff.svg)](https://cran.r-project.org/)
[![packageversion](https://img.shields.io/badge/Package%20version-`r gsub('-', '--', version)`-orange.svg?style=flat-square)](https://github.com/biometryhub/biometryassist/commits/main)
[![Licence](https://img.shields.io/github/license/mashape/apistatus.svg)](https://choosealicense.com/licenses/mit/)
[![](https://cranlogs.r-pkg.org/badges/biometryassist)](https://cran.r-project.org/package=biometryassist)
[![Hits](https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2Fbiometryhub%2Fbiometryassist&count_bg=%2379C83D&title_bg=%23555555&icon=&icon_color=%23E7E7E7&title=hits&edge_flat=false)](https://hits.seeyoufarm.com)
<!-- badges: end -->

Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ coverage](https://codecov.io/gh/biometryhub/biometryassist/branch/main/graph/bad
[![R build
status](https://github.com/biometryhub/biometryassist/workflows/R-CMD-check/badge.svg)](https://github.com/biometryhub/biometryassist/actions)
[![minimal R
version](https://img.shields.io/badge/R%3E%3D-4.0.0-6666ff.svg)](https://cran.r-project.org/)
[![packageversion](https://img.shields.io/badge/Package%20version-1.2.1-orange.svg?style=flat-square)](https://github.com/biometryhub/biometryassist/commits/main)
version](https://img.shields.io/badge/R%3E%3D-4.1.0-6666ff.svg)](https://cran.r-project.org/)
[![packageversion](https://img.shields.io/badge/Package%20version-1.2.2-orange.svg?style=flat-square)](https://github.com/biometryhub/biometryassist/commits/main)
[![Licence](https://img.shields.io/github/license/mashape/apistatus.svg)](https://choosealicense.com/licenses/mit/)
[![](https://cranlogs.r-pkg.org/badges/biometryassist)](https://cran.r-project.org/package=biometryassist)
[![Hits](https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2Fbiometryhub%2Fbiometryassist&count_bg=%2379C83D&title_bg=%23555555&icon=&icon_color=%23E7E7E7&title=hits&edge_flat=false)](https://hits.seeyoufarm.com)
<!-- badges: end -->

Expand Down
16 changes: 8 additions & 8 deletions tests/testthat/test-design.R
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ test_that("3 way factorial designs are possible", {
})

test_that("Adding names to 3 way factorial designs works", {
d9.2 <- design(type = "crossed:rcbd", treatments = c(2, 2, 2), quiet = TRUE,
d9.2 <- design(type = "crossed:rcbd", treatments = c(2, 2, 2), quiet = TRUE,
reps = 3, nrows = 8, ncols = 3, brows = 8, bcols = 1, seed = 42,
fac.names = list(X = c("A", "B"), Y = 1:2, Z = c(10, 20)))

Expand Down Expand Up @@ -348,7 +348,7 @@ test_that("unsupported design types give an error", {
})

test_that("split plot requires sub_treatments", {
expect_error(design(type = "split", treatments = c("A", "B"), quiet = TRUE,
expect_error(design(type = "split", treatments = c("A", "B"), quiet = TRUE,
sub_treatments = NULL, reps = 4, nrows = 8,
ncols = 4, brows = 4, bcols = 2, seed = 42),
"sub_treatments are required for a split plot design")
Expand Down Expand Up @@ -467,7 +467,7 @@ test_that("save = FALSE produces nothing", {
})

test_that("save = 'workbook' produces csv file and not plot", {
design("crd", treatments = 1:11, reps = 4, nrows = 11, ncols = 4,
design("crd", treatments = 1:11, reps = 4, nrows = 11, ncols = 4,
save = "workbook", savename = "crd_design1", quiet = TRUE)
withr::local_file("crd_design1.csv")
expect_true(file.exists("crd_design1.csv"))
Expand All @@ -476,15 +476,15 @@ test_that("save = 'workbook' produces csv file and not plot", {
})

test_that("save = 'plot' produces plot file and not csv", {
design("crd", treatments = 1:11, reps = 4, nrows = 11, ncols = 4,
design("crd", treatments = 1:11, reps = 4, nrows = 11, ncols = 4,
save = "plot", savename = "crd_design2", quiet = TRUE)
withr::local_file("crd_design2.pdf")
expect_false(file.exists("crd_design2.csv"))
expect_true(file.exists("crd_design2.pdf"))
})

test_that("save = 'both' produces plot file and csv", {
design("crd", treatments = 1:11, reps = 4, nrows = 11, ncols = 4,
design("crd", treatments = 1:11, reps = 4, nrows = 11, ncols = 4,
save = "both", savename = "crd_design3", quiet = TRUE)
withr::local_file("crd_design3.pdf")
withr::local_file("crd_design3.csv")
Expand All @@ -494,7 +494,7 @@ test_that("save = 'both' produces plot file and csv", {
})

test_that("save = TRUE produces plot file and csv", {
design("crd", treatments = 1:11, reps = 4, nrows = 11, ncols = 4,
design("crd", treatments = 1:11, reps = 4, nrows = 11, ncols = 4,
save = TRUE, savename = "crd_design4", quiet = TRUE)
withr::local_file("crd_design4.pdf")
withr::local_file("crd_design4.csv")
Expand All @@ -505,15 +505,15 @@ test_that("save = TRUE produces plot file and csv", {

test_that("Output is produced when quiet = FALSE", {
withr::local_file("Rplots.pdf")
expect_output(des <- design("crd", treatments = 1:11, reps = 4,
expect_output(des <- design("crd", treatments = 1:11, reps = 4,
nrows = 11, ncols = 4, quiet = FALSE),
"Source of Variation df")
expect_snapshot(cat(des$satab))
vdiffr::expect_doppelganger(title = "Plot output", des$plot.des)
})

test_that("designs have a class of 'design'", {
d1 <- design("crd", treatments = 1:11, reps = 4,
d1 <- design("crd", treatments = 1:11, reps = 4,
nrows = 11, ncols = 4, quiet = TRUE)
expect_s3_class(d1, "design")
})
Expand Down

0 comments on commit f37be70

Please sign in to comment.