addColumns: Add columns to existing data set

Description Usage Arguments Value Examples

View source: R/addColumns.R

Description

Add columns to existing data set

Usage

1
addColumns(dtDefs, dtOld)

Arguments

dtDefs

Name of definitions for added columns

dtOld

Name of data table that is to be updated

Value

An updated data.table that contains the added simulated data

Examples

 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 Nov. 8, 2018, 7:41 p.m.