Skip to content

Commit

Permalink
Merge pull request #30 from nhs-r-community/27-atomic
Browse files Browse the repository at this point in the history
Changed is_vector to is_character
  • Loading branch information
Lextuga007 authored Jul 11, 2024
2 parents 02c8378 + 83d2c6c commit 9c0c636
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions R/postcode_data_join.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ postcode_data_join <- function(x, var = "postcode", fix_invalid = TRUE) {
autocomp_codes <- NULL
remainder <- NULL

# is_character (vector) ------------------------------------------------------


var <- rlang::as_string(var)

if (is.data.frame(x)) {
Expand All @@ -37,7 +40,7 @@ postcode_data_join <- function(x, var = "postcode", fix_invalid = TRUE) {
dplyr::pull({{ var }}) |>
unique()
} else {
assertthat::assert_that(rlang::is_vector(x))
assertthat::assert_that(rlang::is_character(x))
codes <- unique(x)
}

Expand Down Expand Up @@ -164,7 +167,7 @@ postcode_data_join <- function(x, var = "postcode", fix_invalid = TRUE) {
dplyr::left_join(postcode_data,
by = vctrs::vec_c({{ var }} := "postcode")
)
} else if (rlang::is_vector(x)) {
} else if (rlang::is_character(x)) {
tibble::tibble({{ var }} := x) |>
dplyr::left_join(postcode_data,
by = vctrs::vec_c({{ var }} := "postcode")
Expand Down

0 comments on commit 9c0c636

Please sign in to comment.