Skip to content

Commit

Permalink
rename properly this time
Browse files Browse the repository at this point in the history
  • Loading branch information
teunbrand committed Oct 22, 2024
1 parent 4f650d5 commit 7a17984
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions R/label-dictionary.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-label-lut.R
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 7a17984

Please sign in to comment.