This function wraps osat_score()
in order to take full advantage of the speed gain without
managing the buffered objects in the user code.
osat_score_generator(batch_vars, feature_vars, quiet = FALSE)
A function that returns the OSAT score for a specific sample arrangement
sample_assignment <- tibble::tribble(
~ID, ~SampleType, ~Sex, ~plate,
1, "Case", "Female", 1,
2, "Case", "Female", 1,
3, "Case", "Male", 2,
4, "Control", "Female", 2,
5, "Control", "Female", 1,
6, "Control", "Male", 2,
NA, NA, NA, 1,
NA, NA, NA, 2,
)
osat_scoring_function <- osat_score_generator(
batch_vars = "plate",
feature_vars = c("SampleType", "Sex")
)
osat_scoring_function(sample_assignment)
#> Warning: NAs in features / batch columns; they will be excluded from scoring
#> [1] 3