replace_na.dtplyr_step | R Documentation |
This is a method for the tidyr replace_na()
generic. It is translated to
data.table::fcoalesce()
.
Note that unlike tidyr::replace_na()
, data.table::fcoalesce()
cannot
replace NULL
values in lists.
## S3 method for class 'dtplyr_step'
replace_na(data, replace = list())
data |
A |
replace |
If If |
library(tidyr)
# Replace NAs in a data frame
dt <- lazy_dt(tibble(x = c(1, 2, NA), y = c("a", NA, "b")))
dt %>% replace_na(list(x = 0, y = "unknown"))
# Replace NAs using `dplyr::mutate()`
dt %>% dplyr::mutate(x = replace_na(x, 0))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.