mergeData {simstudy} | R Documentation |
Merge two data tables
Description
Merge two data tables
Usage
mergeData(dt1, dt2, idvars)
Arguments
dt1 |
Name of first data.table |
dt2 |
Name of second data.table |
idvars |
Vector of string names to merge on |
Value
A new data table that merges dt2 with dt1
Examples
def1 <- defData(varname = "x", formula = 0, variance = 1)
def1 <- defData(varname = "xcat", formula = ".3;.2", dist = "categorical")
def2 <- defData(varname = "yBin", formula = 0.5, dist = "binary", id = "xcat")
def2 <- defData(def2, varname = "yNorm", formula = 5, variance = 2)
dt1 <- genData(20, def1)
dt2 <- genData(3, def2)
dtMerge <- mergeData(dt1, dt2, "xcat")
dtMerge
[Package simstudy version 0.8.1 Index]