diff --git a/NEWS.md b/NEWS.md index b02a7a8..e96984a 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,7 @@ # tidyclust (development version) +* Fixed bug when trying to tune the `linkage_method` argument. (#206, @lgaborini) + # tidyclust 0.2.4 * The philentropy package is now used to calculate distances rather than Rfast. (#199) diff --git a/R/dials-params.R b/R/dials-params.R index dc39702..3a1b155 100644 --- a/R/dials-params.R +++ b/R/dials-params.R @@ -32,7 +32,7 @@ linkage_method <- function(values = values_linkage_method) { dials::new_qual_param( type = "character", values = values, - label = c(activation = "Linkage Method"), + label = c(linkage_method = "Linkage Method"), finalize = NULL ) } diff --git a/tests/testthat/test-hier_clust-stats.R b/tests/testthat/test-hier_clust-stats.R index 70f92c0..a8aea5b 100644 --- a/tests/testthat/test-hier_clust-stats.R +++ b/tests/testthat/test-hier_clust-stats.R @@ -90,3 +90,18 @@ test_that("extract_cluster_assignment() works", { expected ) }) + +test_that("all parameters are correctly named", { + # fixes issue #206 + + param_grid <- dials::parameters( + dials::num_clusters(range = c(2, 3)), + linkage_method(), + cut_height(range = c(0, 3)) + ) + + expect_setequal( + param_grid$name, + c("num_clusters", "linkage_method", "cut_height") + ) +})