Closed phiala closed 6 years ago
I can't get the example of using a custom clustering algorithm in ?consensus_clustering to work.
The result is identical whether c("pam", "agnes") or just c("pam") is used.
R version 3.4.1 (2017-06-30) Platform: x86_64-redhat-linux-gnu (64-bit) Running under: Fedora 26 (Workstation Edition)
attached base packages: [1] stats graphics grDevices utils datasets methods base
other attached packages: [1] diceR_0.3.1 setwidth_1.0-4 colorout_0.9-9
Here's the code I used:
data(hgsc) dat <- hgsc[1:100, 1:50] # Custom distance function manh <- function(x) { stats::dist(x, method = "manhattan") } # Custom clustering algorithm agnes <- function(d, k) { return(as.integer(stats::cutree(cluster::agnes(d, diss = TRUE), k))) } assign("agnes", agnes, 1) cc1 <- consensus_cluster(dat, reps = 6, algorithms = c("pam", "agnes"), distance = c("euclidean", "manh"), progress = FALSE) str(cc1) cc2 <- consensus_cluster(dat, reps = 6, algorithms = c("pam"), distance = c("euclidean", "manh"), progress = FALSE) str(cc2) identical(cc1, cc2)
Using just a custom function gives either an error or empty output object.
What am I missing?
Please let me know if you still have unresolved bugs @phiala, thanks for catching this!
I can't get the example of using a custom clustering algorithm in ?consensus_clustering to work.
The result is identical whether c("pam", "agnes") or just c("pam") is used.
R version 3.4.1 (2017-06-30) Platform: x86_64-redhat-linux-gnu (64-bit) Running under: Fedora 26 (Workstation Edition)
attached base packages: [1] stats graphics grDevices utils datasets methods base
other attached packages: [1] diceR_0.3.1 setwidth_1.0-4 colorout_0.9-9
Here's the code I used:
Using just a custom function gives either an error or empty output object.
What am I missing?