Learn R Programming

emil (version 1.1-6)

fill: Replace values with something else

Description

Replace values with something else

Usage

fill(x, pattern, replacement, invert = FALSE)

na.fill(x, replacement)

Arguments

x
Variable containing NAs.
pattern
The values in x to be replaced. Can also be a function.
replacement
The value which is to replace the values matching pattern.
invert
Whether to fill all values except the ones matching pattern.

Value

  • An imputed version of x.

Examples

Run this code
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