Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

makemissing

Create random missing data


Description

Generates missing entries in data.frame/matrix

Usage

makemissing(
  data,
  p = 0.2,
  cols = seq_len(ncol(data)),
  rowwise = FALSE,
  nafun = function(x) x,
  seed = NULL
)

Arguments

data

data.frame

p

Fraction of missing data in each column

cols

Which columns (name or index) to alter

rowwise

Should missing occur row-wise (either none or all selected columns are missing)

nafun

(Optional) function to be applied on data.frame before return (e.g. na.omit to return complete-cases only)

seed

Random seed

Value

data.frame

Author(s)

Klaus K. Holst


lava

Latent Variable Models

v1.6.10
GPL-3
Authors
Klaus K. Holst [aut, cre], Brice Ozenne [ctb], Thomas Gerds [ctb]
Initial release
2021-09-01

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.