library(speed)
df <- initialise_design_df(items = 4, nrows = 4, ncols = 4)
df$blk <- rep(1:4, each = 4)
df$pos <- rep(1:4, times = 4)
a <- speed(df, swap = "treatment", spatial_factors = ~ blk + pos,
grid_factors = list(dim1 = "blk", dim2 = "pos"),
iterations = 500, seed = 3, quiet = TRUE)
b <- speed(df, swap = "treatment", spatial_factors = ~ blk + pos,
grid_factors = list(dim1 = "blkk", dim2 = "pos"), # typo
iterations = 500, seed = 3, quiet = TRUE)
min(a$scores); min(b$scores)
#> [1] 3
#> [1] 1.333333 # silently used row/col instead
infer_row_col()falls through to pattern matching when the named columns are absent so a typo optimises a different grid with no warning and reports success.Expected: warn or error when
dim1/dim2are supplied but not found, rather than falling through..verify_grid_by()already guardsby=for exactly this reason but dim1/dim2 are unguarded.