First sample is assigned to the first location, second sample is assigned to the second location, etc.
assign_in_order(batch_container, samples = NULL)
Instance of BatchContainer class
data.frame with samples.
Returns a new BatchContainer
.
samples <- data.frame(sampId = 1:3, sampName = letters[1:3])
samples
#> sampId sampName
#> 1 1 a
#> 2 2 b
#> 3 3 c
bc <- BatchContainer$new(dimensions = c("row" = 3, "column" = 2))
bc
#> Batch container with 6 locations.
#> Dimensions: row, column
set.seed(42)
# assigns samples randomly
bc <- assign_random(bc, samples)
bc$get_samples()
#> # A tibble: 6 × 4
#> row column sampId sampName
#> <int> <int> <int> <chr>
#> 1 1 1 1 a
#> 2 1 2 NA NA
#> 3 2 1 NA NA
#> 4 2 2 NA NA
#> 5 3 1 2 b
#> 6 3 2 3 c
# assigns samples in order
bc <- assign_in_order(bc)
bc$get_samples()
#> # A tibble: 6 × 4
#> row column sampId sampName
#> <int> <int> <int> <chr>
#> 1 1 1 1 a
#> 2 1 2 2 b
#> 3 2 1 3 c
#> 4 2 2 NA NA
#> 5 3 1 NA NA
#> 6 3 2 NA NA