Description Usage Arguments Value Examples

Add single row to definitions table that will be used to add data to an existing data.table

1 2 | ```
defDataAdd(dtDefs = NULL, varname, formula, variance = 0,
dist = "normal", link = "identity")
``` |

`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 |

A data.table named dtName that is an updated data definitions table

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ```
# 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
``` |

kgoldfeld/simstudy documentation built on Dec. 23, 2018, 5:33 a.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.