IIUC, when multiple columns of cluster_codes could match the levels of cluster_id, the first one is selected silently.
|
if (is.null(k)) { |
|
kids <- levels(y$cluster_id) |
|
same <- vapply(cluster_codes(x), function(u) |
|
identical(levels(u), kids), logical(1)) |
|
if (!any(same)) |
|
stop("Couldn't match any clustering", |
|
" in input data 'x' with results in 'y'.") |
|
k <- names(cluster_codes(x))[same][1] |
|
} else { |
|
k <- .check_k(x, k) |
|
} |
|
x$cluster_id <- cluster_ids(x, k) |
IMO, if sum(same) > 1 a warning must be raised show the selected column/clustering, or, an error must be raised to force the user to select the clustering column (k argument).
IIUC, when multiple columns of
cluster_codescould match the levels ofcluster_id, the first one is selected silently.CATALYST/R/plotDiffHeatmap.R
Lines 140 to 151 in f3e294e
IMO, if
sum(same) > 1a warning must be raised show the selected column/clustering, or, an error must be raised to force the user to select the clustering column (kargument).