Skip to contents

[Stable]

Replace column values with NAs.

Usage

mutate_na(ds, na_vars = NULL, na_percentage = 0.05)

Arguments

ds

(data.frame)
Any data set.

na_vars

(list)
A named list where the name of each element is a column name of ds. Each element of this list should be a numeric vector with two elements:

  • seed (numeric)
    The seed to be used for this element - can be NA.

  • percentage (proportion)
    Percentage of elements to be replaced with NA. If NA, na_percentage is used as a default.

na_percentage

(proportion)
Default percentage of values to be replaced by NA.

Value

dataframe without NA values.