This function replaces NAs by a value
Usage
replace_na(.data, ..., .value = 0)
Arguments
- .data
data frame
- ...
variables. If no variables were provided, the function will fill
in Missing Values for all variables.
- .value
value for NAs be replaced by
Examples
tibble::tibble(
var1 = c(1,2,3,4, NA),
var2 = c(NA, NA, NaN, 2, 3)
) -> data
replace_na(data, .value = 0)
#> # A tibble: 5 × 2
#> var1 var2
#> <dbl> <dbl>
#> 1 1 0
#> 2 2 0
#> 3 3 0
#> 4 4 2
#> 5 0 3