defDataAdd {simstudy} | R Documentation |
Add single row to definitions table that will be used to add data to an existing data.table
Description
Add single row to definitions table that will be used to add data to an existing data.table
Usage
defDataAdd(
dtDefs = NULL,
varname,
formula,
variance = 0,
dist = "normal",
link = "identity"
)
Arguments
dtDefs |
Name of definition table to be modified. Null if this is a new definition. |
varname |
Name (string) of new variable |
formula |
An R expression for mean (string) |
variance |
Number |
dist |
Distribution. For possibilities, see details |
link |
The link function for the mean, see details |
Value
A data.table named dtName that is an updated data definitions table
See Also
[distributions]
Examples
# New data set
def <- defData(varname = "xNr", dist = "nonrandom", formula = 7, id = "idnum")
def <- defData(def, varname = "xUni", dist = "uniform", formula = "10;20")
dt <- genData(10, def)
# Add columns to dt
def2 <- defDataAdd(varname = "y1", formula = 10, variance = 3)
def2 <- defDataAdd(def2, varname = "y2", formula = .5, dist = "binary")
def2
dt <- addColumns(def2, dt)
dt
[Package simstudy version 0.8.1 Index]