Learn R Programming

popEpi (version 0.3.1)

na2zero: Convert NA's to zero in data.table

Description

Given a data.table DT, replaces any NA values in the variables given in vars in DT. Takes a copy of the original data and returns the modified copy.

Usage

na2zero(DT, vars = NULL)

Arguments

DT
data.table object
vars
a character string vector of variables names in DT; if NULL, uses all variable names in DT

Details

Given a data.table object, converts NA values to numeric (double) zeroes for all variables named in vars or all variables if vars = NULL.