augment_density: Add an empirical-density variable to existing data

View source: R/empirical.R

augment_densityR Documentation

Add an empirical-density variable to existing data

Description

Add an empirical-density variable to existing data

Usage

augment_density(
  data,
  values,
  variable,
  use_limits = FALSE,
  keep_missing = FALSE,
  seed = NULL
)

Arguments

data

Destination base data.frame.

values

Numeric source values, of which at least two must be present and distinct.

variable

Name of the new variable.

use_limits, keep_missing, seed

Density-simulation arguments, as in simulate_density().

Value

A simulab_sim base data.frame with the density variable added.

Examples

values <- stats::rnorm(200, mean = 5, sd = 2)
data <- data.frame(id = 1:50)
result <- augment_density(data, values = values, variable = "score", seed = 1)
head(result)

simulab documentation built on Oct. 15, 2026, 5:08 p.m.