print_misspelled_values() incorrectly uses [[ to subset a data column with the row indices returned by detect_misspelled_options2().
undefined_opts <- data[[option]][[misspelled_options[[option]]]]
Proposed fix
Replace [[ with [:
print_misspelled_values <- function(data, misspelled_options) {
for (option in names(misspelled_options)) {
undefined_opts <- unique(data[[option]][misspelled_options[[option]]])
cli::cli_alert_warning(
tr_(
"Cannot replace {.val {toString(undefined_opts)}} present in column {.field {option}} but not defined in the dictionary."
)
)
}
invisible(NULL)
}
Using [ supports a vector of row indices, while unique() avoids printing the same undefined value repeatedly.
print_misspelled_values()incorrectly uses[[to subset a data column with the row indices returned bydetect_misspelled_options2().Proposed fix
Replace
[[with[:Using
[supports a vector of row indices, whileunique()avoids printing the same undefined value repeatedly.