Skip to content

Commit 2e64510

Browse files
committed
use check.names in wideFormat internal helper, closes #343
1 parent ff72159 commit 2e64510

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

R/MultiAssayExperiment-helpers.R

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -343,8 +343,11 @@ setMethod("mergeReplicates", "ANY",
343343
return(object)
344344
})
345345

346-
.matchAddColData <- function(reshaped, colData, colDataCols) {
347-
extraColumns <- as.data.frame(colData[, colDataCols, drop = FALSE])
346+
.matchAddColData <- function(reshaped, colData, colDataCols, check.names) {
347+
optional <- !check.names
348+
extraColumns <- as.data.frame(
349+
colData[, colDataCols, drop = FALSE], optional = optional
350+
)
348351
rowNameValues <- rownames(extraColumns)
349352
rownames(extraColumns) <- NULL
350353
matchIdx <- match(reshaped[["primary"]], rowNameValues)
@@ -588,7 +591,9 @@ wideFormat <- function(object, colDataCols = NULL, check.names = TRUE,
588591

589592
wideData <- lapply(wideData, function(flox) {
590593
flox <- tidyr::pivot_wider(flox, names_from = key)
591-
.matchAddColData(flox, colData(object), colDataCols)
594+
.matchAddColData(
595+
flox, colData(object), colDataCols, check.names = check.names
596+
)
592597
})
593598
wideDF <- Reduce(function(x, y)
594599
merge(x, y, by = intersect(names(x), names(y)), all = TRUE), wideData)

0 commit comments

Comments
 (0)