This method can apply to numeric vector, data.frame/tibble. grouped_df. If you want to apply to data.frame/tibble, please library(dplyr).

fill_na(x, ...)

# S3 method for default
fill_na(x, ...)

# S3 method for tbl_df
fill_na(x, ...)

# S3 method for data.frame
fill_na(x, ...)

Arguments

x

a data.frame or a vector

...

col names character vector or just bare name.

Value

data.frame or a vector

See also

Examples

x <- c(1, NA, NA, 2, 3) y <- c(NA, NA, 1, NA, 3) xy <- data.frame(x,y) fill_na(x)
#> [1] 1 1 1 2 3
fill_na(y)
#> [1] 1 1 1 1 3
# NOT RUN { # require(dplyr) fill_na(xy, x, y) fill_na(xy, c("x","y")) fill_na(xy, starts_with("x")) # }