Delete columns from existing data set

delColumns(dtOld, vars)

Arguments

dtOld

Name of data table that is to be updated.

vars

Vector of column names (as strings).

Value

An updated data.table without vars.

Examples

# New data set

def <- defData(varname = "x", dist = "noZeroPoisson", formula = 7, id = "idnum")
def <- defData(def, varname = "xUni", dist = "uniformInt", formula = "x-3;x+3")

dt <- genData(10, def)
dt
#> Key: <idnum>
#>     idnum     x  xUni
#>     <int> <num> <int>
#>  1:     1    11    10
#>  2:     2     7     5
#>  3:     3     5     3
#>  4:     4     6     3
#>  5:     5    12    13
#>  6:     6     6     8
#>  7:     7     6     3
#>  8:     8     8    10
#>  9:     9     6     4
#> 10:    10     9     7

# Delete column

dt <- delColumns(dt, "x")
dt
#> Key: <idnum>
#>     idnum  xUni
#>     <int> <int>
#>  1:     1    10
#>  2:     2     5
#>  3:     3     3
#>  4:     4     3
#>  5:     5    13
#>  6:     6     8
#>  7:     7     3
#>  8:     8    10
#>  9:     9     4
#> 10:    10     7