From 676046f35ff04f51f8902141f331583c9666b33a Mon Sep 17 00:00:00 2001 From: Hadley Wickham Date: Sun, 11 Dec 2022 13:58:16 -0600 Subject: [PATCH] Fix for dev dplyr `na_if()` correctly errors rather than converting the vector to a string. dev dplyr is currently scheduled for release on Jan 27. --- R/tidying_functions.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/tidying_functions.R b/R/tidying_functions.R index 5108bdc2..85e08cca 100644 --- a/R/tidying_functions.R +++ b/R/tidying_functions.R @@ -94,7 +94,7 @@ score <- function(.data, items, instrument, na.rm = TRUE, prefix = "", suffix = } scores <- item_data %>% dplyr::transmute(!!new_name := rowMeans(item_data[, item_nums], na.rm)) %>% - dplyr::mutate_all(~dplyr::na_if(., "NaN")) + dplyr::mutate_all(~dplyr::na_if(., NaN)) .data <- dplyr::bind_cols(.data, scores) } .data