Skip to content

Commit

Permalink
Fix blocking conditionality
Browse files Browse the repository at this point in the history
  • Loading branch information
pinin4fjords committed Oct 17, 2023
1 parent 052f461 commit 94c68b3
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions R/accessory.R
Original file line number Diff line number Diff line change
Expand Up @@ -915,7 +915,7 @@ read_contrasts <-
contrasts <- read_metadata(filename)
contrast_cols <- c(variable_column, reference_column, target_column)
if (! blocking_column %in% names(contrasts)){
contrasts[[blocking_column]] <- ''
contrasts[[blocking_column]] <- NA
}

# Check contrast headers are as expected
Expand All @@ -930,12 +930,12 @@ read_contrasts <-

success <- checkListIsSubset(contrasts$variable, colnames(samples), "contrast variables", "sample metadata")

if (! blocking_column %in% names(contrasts)){
blocking <- unlist(lapply(contrasts[[blocking_column]], function(x) simpleSplit(x, ";")))
blocking <- blocking[!is.na(blocking)]
if (length(blocking > 0)) {
success <- checkListIsSubset(blocking, colnames(samples), "blocking variables", "sample metadata")
}
# Check blocking variables, where supplied

blocking <- unlist(lapply(contrasts[[blocking_column]], function(x) simpleSplit(x, ";")))
blocking <- blocking[!is.na(blocking)]
if (length(blocking > 0)) {
success <- checkListIsSubset(blocking, colnames(samples), "blocking variables", "sample metadata")
}

## 'reference', 'target', and 'blocking' should be values of their variable
Expand Down

0 comments on commit 94c68b3

Please sign in to comment.