View source: R/generate_data.R
| genDataDensity | R Documentation |
Data are generated from an a density defined by a vector of integers
genDataDensity(
n,
dataDist,
varname,
uselimits = FALSE,
id = "id",
na.rm = TRUE
)
n |
Integer. Number of samples to draw from the density. |
dataDist |
Numeric vector. Defines the desired density. |
varname |
Character. Name of the variable. |
uselimits |
Logical. If TRUE, the minimum and maximum of the input data vector are used as limits for sampling. Defaults to FALSE, in which case a smoothed density that extends beyond these limits is used. |
id |
Character. A string specifying the field that serves as the record ID. The default field is "id". |
na.rm |
Logical. If TRUE (default), missing values in 'dataDist' are removed. If FALSE, the data will retain the same proportion of missing values. |
A data table with the generated data
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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.