Skip to content

linkage_method() parameter incorrectly labeled as "activation" in grid functions #213

@dnldelarosa

Description

@dnldelarosa

The linkage_method() parameter function in tidyclust incorrectly labels the parameter as "activation" instead of "linkage_method" when used in grid creation functions like grid_regular().

Root Cause

File: R/dials-params.R
Line: 38

The linkage_method() function has a hardcoded label name:

linkage_method <- function(values = values_linkage_method) {
  dials::new_qual_param(
    type = "character",
    values = values,
    label = c(activation = "Linkage Method"),  # ← Should be "linkage_method"
    finalize = NULL
  )
}

Fix

Change line 38 from:

label = c(activation = "Linkage Method"),

To:

label = c(linkage_method = "Linkage Method"),

Impact

This forces users to manually rename the column with rename(linkage_method = activation) before using it with tune_cluster(), as shown in the current documentation and tutorials.

Reproducible Example

library(dials)
library(tidyclust)

# Current behavior - creates "activation" column instead of "linkage_method"
grid_regular(
  num_clusters(range = c(2, 4)),
  linkage_method(values = c("complete", "average", "ward.D2")),
  levels = c(3, 3)
)
#> # A tibble: 9 × 2
#>   num_clusters activation
#>          <int> <chr>     
#> 1            2 complete  
#> 2            3 complete  
#> 3            4 complete  
#> # ... with 6 more rows

After the fix, it should produce:

#> # A tibble: 9 × 2
#>   num_clusters linkage_method
#>          <int> <chr>         
#> 1            2 complete      
#> 2            3 complete      
#> 3            4 complete      
#> # ... with 6 more rows

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions