genDataDensity {simstudy} | R Documentation |
Generate data from a density defined by a vector of integers
Description
Data are generated from an a density defined by a vector of integers
Usage
genDataDensity(n, dataDist, varname, uselimits = FALSE, id = "id")
Arguments
n |
Number of samples to draw from the density. |
dataDist |
Vector that defines the desired density |
varname |
Name of variable name |
uselimits |
Indicator to use minimum and maximum of input data vector as limits for sampling. Defaults to FALSE, in which case a smoothed density that extends beyond the limits is used. |
id |
A string specifying the field that serves as the record id. The default field is "id". |
Value
A data table with the generated data
Examples
data_dist <- data_dist <- c(1, 2, 2, 3, 4, 4, 4, 5, 6, 6, 7, 7, 7, 8, 9, 10, 10)
genDataDensity(500, data_dist, varname = "x1", id = "id")
genDataDensity(500, data_dist, varname = "x1", uselimits = TRUE, id = "id")
[Package simstudy version 0.8.1 Index]