powered by
use tidyselect to fill NA values Default behavior is to fill all integer or double columns cols with 0, preserving their types.
NA
fill_na(.data, ..., fill = 0L, missing_type = c("all", "NA", "NaN", "Inf"))
data frame
tidyselect specification. Default selection: none
value to fill missings
character vector. Choose what type of missing to fill. Default is all types. choose from "all", "Na", "NaN", "Inf"
tibble::tibble(x = c(NA, 1L, 2L, NA, NaN, 5L, Inf)) -> tbl tbl %>% fill_na() tbl %>% fill_na(fill = 1L, missing_type = "Inf") tbl %>% fill_na(missing_type = "NaN")
Run the code above in your browser using DataLab