diff --git a/R/label-dictionary.R b/R/label-dictionary.R index 0c296f86..15dd12e1 100644 --- a/R/label-dictionary.R +++ b/R/label-dictionary.R @@ -33,14 +33,14 @@ #' ) label_dictionary <- function(dictionary = character(), nomatch = NULL) { - if (!is.character(lut)) { - cli::cli_abort("The {.arg lut} argument must be a character vector.") + if (!is.character(dictionary)) { + cli::cli_abort("The {.arg dictionary} argument must be a character vector.") } - if (!is_named2(lut)) { - cli::cli_abort("The {.arg lut} argument must have names.") + if (!is_named2(dictionary)) { + cli::cli_abort("The {.arg dictionary} argument must have names.") } - names <- names(lut) - values <- unname(lut) + names <- names(dictionary) + values <- unname(dictionary) force(nomatch) diff --git a/tests/testthat/test-label-lut.R b/tests/testthat/test-label-lut.R index 4b692024..eed01331 100644 --- a/tests/testthat/test-label-lut.R +++ b/tests/testthat/test-label-lut.R @@ -3,7 +3,7 @@ test_that("label_dictionary gives correct answers", { short <- c("A", "B", "C") lut <- c("A" = "Apple", "C" = "Cherry", "D" = "Date") - expect_equal(label__dictionary(lut)(short), c("Apple", "B", "Cherry")) + expect_equal(label_dictionary(lut)(short), c("Apple", "B", "Cherry")) expect_equal( label_dictionary(lut, nomatch = "Banana")(short), c("Apple", "Banana", "Cherry")