powered by
Replace values with something else
fill(x, pattern, replacement, invert = FALSE)na_fill(x, replacement)
na_fill(x, replacement)
Variable containing NAs.
The values in x to be replaced. Can also be a function.
x
The value which is to replace the values matching pattern.
pattern
Whether to fill all values except the ones matching pattern.
An imputed version of x.
# NOT RUN { fill(1:10, function(x) x %% 2 == 1, 0) na_fill(c(1,2,NA,4,5), 3) # }
Run the code above in your browser using DataLab