From 24e3236b30d6edec35e6f08791d7a7d337a3eee4 Mon Sep 17 00:00:00 2001 From: Adam Stone <31513760+foundinblank@users.noreply.github.com> Date: Fri, 23 Feb 2018 09:03:11 +0000 Subject: [PATCH] added new example using mutate() to further clarify how to use replace_na() in data frames. from https://github.com/tidyverse/tidyr/issues/427 --- R/replace_na.R | 1 + 1 file changed, 1 insertion(+) diff --git a/R/replace_na.R b/R/replace_na.R index 184e51a3d..f8201fb67 100644 --- a/R/replace_na.R +++ b/R/replace_na.R @@ -10,6 +10,7 @@ #' library(dplyr) #' df <- tibble(x = c(1, 2, NA), y = c("a", NA, "b"), z = list(1:5, NULL, 10:20)) #' df %>% replace_na(list(x = 0, y = "unknown")) +#' df %>% mutate(x = replace_na(x, 0)) #' #' # NULL are the list-col equivalent of NAs #' df %>% replace_na(list(z = list(5)))