Replace missing values

replace_na(data, replace = list(), ...)

Arguments

data

A data frame.

replace

A named list given the value to replace NA with for each column.

...

Additional arguments for methods. Currently unused.

Examples

library(dplyr) df <- data_frame(x = c(1, 2, NA), y = c("a", NA, "b")) df %>% replace_na(list(x = 0, y = "unknown"))
#> # A tibble: 3 × 2 #> x y #> <dbl> <chr> #> 1 1 a #> 2 2 unknown #> 3 0 b