Replace all NAs in a data.table by reference

replaceNAByReference(
  DT,
  cols = NULL,
  replacement = list(numeric = 0, integer = 0L)
)

Arguments

DT

A data.table.

cols

A vector of column names in which to replace the NAs. Use NA to replace in all columns.

replacement

A single value or a list of values for each primitive type to replace by. The default list(numeric = 0, integer = 0L) replaces NAs by 0 for all nnumeric and integer columns listed in cols.