Description Usage Arguments Value Examples

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

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

`dtDefs` |
Name of definition table to be modified. Null if this is a new definition. |

`condition` |
Formula specifying condition to be checked |

`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 16 17 18 19 20 21 22 23 24 | ```
# New data set
def <- defData(varname = "x", dist = "noZeroPoisson", formula=5)
def <- defData(def, varname="y", dist="normal", formula=0, variance=9)
dt <- genData(10, def)
# Add columns to dt
defC <- defCondition(condition = "x == 1", formula = "5 + 2*y",
variance = 1,dist = "normal")
defC <- defCondition(defC, condition = "x <= 5 & x >= 2", formula = "3 - 2*y",
variance = 1, dist="normal")
defC <- defCondition(defC, condition = "x >= 6", formula = 1,
variance = 1, dist="normal")
defC
# Add conditional column with field name "z"
dt <- addCondition(defC, dt, "z")
dt
``` |

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.