set-prop-n-miss: Set a proportion or number of missing values

set-prop-n-missR Documentation

Set a proportion or number of missing values

Description

Set a proportion or number of missing values

Usage

set_prop_miss(x, prop = 0.1)

set_n_miss(x, n = 1)

Arguments

x

vector of values to set missing

prop

proportion of values between 0 and 1 to set as missing

n

number of values to set missing

Value

vector with missing values added

Examples

vec <- rnorm(5)
set_prop_miss(vec, 0.2)
set_prop_miss(vec, 0.4)
set_n_miss(vec, 1)
set_n_miss(vec, 4)

naniar documentation built on May 29, 2024, 1:43 a.m.