Learn R Programming

emil (version 2.2.10)

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
# 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